<?xml version="1.0" encoding="UTF-8"?>
	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"

			>

	<channel>

		<title>Anchors getting clicked on touch on mobile &#8211; Themeco Community</title>
		<atom:link href="https://theme.co/archive/forums/topic/anchors-getting-clicked-on-touch-on-mobile/feed/" rel="self" type="application/rss+xml" />
		<link>https://theme.co/archive/forums/topic/anchors-getting-clicked-on-touch-on-mobile/feed/</link>
		<description></description>
		<lastBuildDate>Sat, 25 Oct 2025 21:43:08 +0000</lastBuildDate>
		<generator>https://bbpress.org/?v=2.6.14</generator>
		<language>en-US</language>

		
														
					
				<item>
					<guid>https://theme.co/archive/forums/topic/anchors-getting-clicked-on-touch-on-mobile/#post-357548</guid>
					<title><![CDATA[Anchors getting clicked on touch on mobile]]></title>
					<link>https://theme.co/archive/forums/topic/anchors-getting-clicked-on-touch-on-mobile/#post-357548</link>
					<pubDate>Wed, 12 Aug 2015 22:19:23 +0000</pubDate>
					<dc:creator>thorsteinn</dc:creator>

					<description>
						<![CDATA[
						<p>Hello</p>
<p>I´m using anchors to jump to different parts on a page (#nameofid) and it works as expected on desktop but on mobile the link gets clicked as soon as the finger touches it.</p>
<p>Normal links/buttons etc are working fine, but it appears as the smooth scrolling is waiting for a mousedown event which causes troubles when swiping on a mobile device.</p>
<p>I can see it´s the same behaviour as the back to top arrow so I wanted to see if anyone knew what file I needed to modify so that the smooth scrolling is only done when the finger gets released?</p>
<p>Thanks</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/anchors-getting-clicked-on-touch-on-mobile/#post-357680</guid>
					<title><![CDATA[Reply To: Anchors getting clicked on touch on mobile]]></title>
					<link>https://theme.co/archive/forums/topic/anchors-getting-clicked-on-touch-on-mobile/#post-357680</link>
					<pubDate>Thu, 13 Aug 2015 01:57:40 +0000</pubDate>
					<dc:creator>Friech</dc:creator>

					<description>
						<![CDATA[
						<p>Hi There,</p>
<p>Thanks for writing in! Would you mind providing us the site URL so we can take a closer look.</p>
<p>Cheers!</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/anchors-getting-clicked-on-touch-on-mobile/#post-358044</guid>
					<title><![CDATA[Reply To: Anchors getting clicked on touch on mobile]]></title>
					<link>https://theme.co/archive/forums/topic/anchors-getting-clicked-on-touch-on-mobile/#post-358044</link>
					<pubDate>Thu, 13 Aug 2015 08:03:01 +0000</pubDate>
					<dc:creator>thorsteinn</dc:creator>

					<description>
						<![CDATA[
						This reply has been marked as private.						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/anchors-getting-clicked-on-touch-on-mobile/#post-358053</guid>
					<title><![CDATA[Reply To: Anchors getting clicked on touch on mobile]]></title>
					<link>https://theme.co/archive/forums/topic/anchors-getting-clicked-on-touch-on-mobile/#post-358053</link>
					<pubDate>Thu, 13 Aug 2015 08:14:51 +0000</pubDate>
					<dc:creator>Rue Nel</dc:creator>

					<description>
						<![CDATA[
						<p>Hello There,</p>
<p>We would not recommend editing any js file as these will just be overwritten when there is an update of X. Please use this code instead in your customizer, <strong>Appearance &gt; Customize &gt; Custom &gt; Javascript</strong></p>
<pre><code>jQuery(document).ready(function($) {

  //
  // Scroll trigger.
  //

  $(&#039;a[href*=&quot;#&quot;]&#039;).on(&#039;touchstart&#039;, function(e) {
    return false;
  });

  $(&#039;a[href*=&quot;#&quot;]&#039;).on(&#039;touchend click&#039;, function(e) {
    $href            = $(this).attr(&#039;href&#039;);
    notComments      = $href.indexOf(&#039;#comments&#039;) === -1;
    notAccordion     = $href.indexOf(&#039;#collapse-&#039;) === -1;
    notTabbedContent = $href.indexOf(&#039;#tab-&#039;) === -1;
    if ( $href !== &#039;#&#039; &amp;&amp; notComments &amp;&amp; notAccordion &amp;&amp; notTabbedContent ) {
      var theId = $href.split(&#039;#&#039;).pop();
      var $el   = $(&#039;#&#039; + theId);
      if ( $el.length &gt; 0 ) {
        e.preventDefault();
        animateOffset($el, 850, &#039;easeInOutExpo&#039;);
      }
    }
  });

});</code></pre>
<p>Please let us know if this works out for you.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/anchors-getting-clicked-on-touch-on-mobile/#post-358225</guid>
					<title><![CDATA[Reply To: Anchors getting clicked on touch on mobile]]></title>
					<link>https://theme.co/archive/forums/topic/anchors-getting-clicked-on-touch-on-mobile/#post-358225</link>
					<pubDate>Thu, 13 Aug 2015 12:10:14 +0000</pubDate>
					<dc:creator>thorsteinn</dc:creator>

					<description>
						<![CDATA[
						<p>Thanks for the quick reply, but unfortunately it did not fix it for me.</p>
<p>I get this error now &#8220;Uncaught ReferenceError: animateOffset is not defined&#8221;, and the same scrolling behavior is occurring.</p>
<p>Just for fun I tried changing line 200 in /themes/x/framework/js/src/site/inc/x-body-scrollspy.js</p>
<p>from<br />
$(&#8216;a[href*=&#8221;#&#8221;]&#8217;).on(&#8216;touchstart click&#8217;, function(e) {</p>
<p>to<br />
$(&#8216;a[href*=&#8221;#&#8221;]&#8217;).on(&#8216;touchend click&#8217;, function(e) {</p>
<p>But that did not change it</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/anchors-getting-clicked-on-touch-on-mobile/#post-358226</guid>
					<title><![CDATA[Reply To: Anchors getting clicked on touch on mobile]]></title>
					<link>https://theme.co/archive/forums/topic/anchors-getting-clicked-on-touch-on-mobile/#post-358226</link>
					<pubDate>Thu, 13 Aug 2015 12:11:37 +0000</pubDate>
					<dc:creator>thorsteinn</dc:creator>

					<description>
						<![CDATA[
						This reply has been marked as private.						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/anchors-getting-clicked-on-touch-on-mobile/#post-358294</guid>
					<title><![CDATA[Reply To: Anchors getting clicked on touch on mobile]]></title>
					<link>https://theme.co/archive/forums/topic/anchors-getting-clicked-on-touch-on-mobile/#post-358294</link>
					<pubDate>Thu, 13 Aug 2015 13:59:12 +0000</pubDate>
					<dc:creator>Paul R</dc:creator>

					<description>
						<![CDATA[
						<p>Hi,</p>
<p>Please change the javascript code above to this.</p>
<pre><code>

jQuery(document).ready(function($) {

  function animateOffset( element, ms, easing ) {
    $(&#039;html, body&#039;).animate({
      scrollTop: $(element).offset().top - adminbarHeight - navbarFixedTopHeight + 1
    }, ms, easing);
  }

  $(&#039;a[href*=&quot;#&quot;]&#039;).on(&#039;touchstart&#039;, function(e) {
    return false;
  });

  $(&#039;a[href*=&quot;#&quot;]&#039;).on(&#039;touchend click&#039;, function(e) {
    $href            = $(this).attr(&#039;href&#039;);
    notComments      = $href.indexOf(&#039;#comments&#039;) === -1;
    notAccordion     = $href.indexOf(&#039;#collapse-&#039;) === -1;
    notTabbedContent = $href.indexOf(&#039;#tab-&#039;) === -1;
    if ( $href !== &#039;#&#039; &amp;&amp; notComments &amp;&amp; notAccordion &amp;&amp; notTabbedContent ) {
      var theId = $href.split(&#039;#&#039;).pop();
      var $el   = $(&#039;#&#039; + theId);
      if ( $el.length &gt; 0 ) {
        e.preventDefault();
        animateOffset($el, 850, &#039;easeInOutExpo&#039;);
      }
    }
  });

});
</code></pre>
<p>If that doesn&#8217;t help, please provide us you wordpress admin login so we could take a closer look.</p>
<p>Thanks</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/anchors-getting-clicked-on-touch-on-mobile/#post-358366</guid>
					<title><![CDATA[Reply To: Anchors getting clicked on touch on mobile]]></title>
					<link>https://theme.co/archive/forums/topic/anchors-getting-clicked-on-touch-on-mobile/#post-358366</link>
					<pubDate>Thu, 13 Aug 2015 15:52:49 +0000</pubDate>
					<dc:creator>thorsteinn</dc:creator>

					<description>
						<![CDATA[
						This reply has been marked as private.						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/anchors-getting-clicked-on-touch-on-mobile/#post-358525</guid>
					<title><![CDATA[Reply To: Anchors getting clicked on touch on mobile]]></title>
					<link>https://theme.co/archive/forums/topic/anchors-getting-clicked-on-touch-on-mobile/#post-358525</link>
					<pubDate>Thu, 13 Aug 2015 19:12:20 +0000</pubDate>
					<dc:creator>Zeshan</dc:creator>

					<description>
						<![CDATA[
						<p>Hi there,</p>
<p>I checked your website but I couldn&#8217;t find the JS code in your Customizer. However, you can replace the previous provided JS code with this and it should resolve the issue:</p>
<pre><code>jQuery(document).ready(function($) {

  var adminbarHeight       = $(&#039;#wpadminbar&#039;).outerHeight();
  var navbarFixedTopHeight = $(&#039;.x-navbar-fixed-top-active .x-navbar&#039;).outerHeight();
  
  function animateOffset( element, ms, easing ) {
    $(&#039;html, body&#039;).animate({
      scrollTop: $(element).offset().top - adminbarHeight - navbarFixedTopHeight + 1
    }, ms, easing);
  }

  //
  // Scroll trigger.
  //

  $(&#039;a[href*=&quot;#&quot;]&#039;).off(&#039;touchstart&#039;);
  $(&#039;a[href*=&quot;#&quot;]&#039;).on(&#039;touchend click&#039;, function(e) {
    $href            = $(this).attr(&#039;href&#039;);
    notComments      = $href.indexOf(&#039;#comments&#039;) === -1;
    notAccordion     = $href.indexOf(&#039;#collapse-&#039;) === -1;
    notTabbedContent = $href.indexOf(&#039;#tab-&#039;) === -1;
    if ( $href !== &#039;#&#039; &amp;&amp; notComments &amp;&amp; notAccordion &amp;&amp; notTabbedContent ) {
      var theId = $href.split(&#039;#&#039;).pop();
      var $el   = $(&#039;#&#039; + theId);
      if ( $el.length &gt; 0 ) {
        e.preventDefault();
        animateOffset($el, 850, &#039;easeInOutExpo&#039;);
      }
    }
  });

});
</code></pre>
<p>Hope this helps. 🙂</p>
<p>Thank you.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>https://theme.co/archive/forums/topic/anchors-getting-clicked-on-touch-on-mobile/#post-359926</guid>
					<title><![CDATA[Reply To: Anchors getting clicked on touch on mobile]]></title>
					<link>https://theme.co/archive/forums/topic/anchors-getting-clicked-on-touch-on-mobile/#post-359926</link>
					<pubDate>Sat, 15 Aug 2015 15:33:41 +0000</pubDate>
					<dc:creator>thorsteinn</dc:creator>

					<description>
						<![CDATA[
						<p>Awesome thanks!</p>
<p>Did a small modification and replaced touchend with onclick :</p>
<pre><code>jQuery(document).ready(function($) {

  var adminbarHeight       = $(&#039;#wpadminbar&#039;).outerHeight();
  var navbarFixedTopHeight = $(&#039;.x-navbar-fixed-top-active .x-navbar&#039;).outerHeight();
  
  function animateOffset( element, ms, easing ) {
    $(&#039;html, body&#039;).animate({
      scrollTop: $(element).offset().top - adminbarHeight - navbarFixedTopHeight + 1
    }, ms, easing);
  }

  //
  // Scroll trigger.
  //

  $(&#039;a[href*=&quot;#&quot;]&#039;).off(&#039;touchstart&#039;);
  $(&#039;a[href*=&quot;#&quot;]&#039;).on(&#039;onclick&#039;, function(e) {
    $href            = $(this).attr(&#039;href&#039;);
    notComments      = $href.indexOf(&#039;#comments&#039;) === -1;
    notAccordion     = $href.indexOf(&#039;#collapse-&#039;) === -1;
    notTabbedContent = $href.indexOf(&#039;#tab-&#039;) === -1;
    if ( $href !== &#039;#&#039; &amp;&amp; notComments &amp;&amp; notAccordion &amp;&amp; notTabbedContent ) {
      var theId = $href.split(&#039;#&#039;).pop();
      var $el   = $(&#039;#&#039; + theId);
      if ( $el.length &gt; 0 ) {
        e.preventDefault();
        animateOffset($el, 850, &#039;easeInOutExpo&#039;);
      }
    }
  });

});</code></pre>
<p>Now it&#8217;s working like I wanted</p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

