<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Improved Animated Scrolling Script for Same-Page Links</title>
	<atom:link href="http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links/feed" rel="self" type="application/rss+xml" />
	<link>http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links</link>
	<description>Tips, techniques, and tutorials for the jQuery JavaScript library</description>
	<lastBuildDate>Mon, 13 May 2013 11:51:37 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: Karl Swedberg</title>
		<link>http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links/comment-page-1#comment-87432</link>
		<dc:creator>Karl Swedberg</dc:creator>
		<pubDate>Thu, 07 Feb 2013 18:04:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links#comment-87432</guid>
		<description><![CDATA[The problem might be the selector in &lt;code&gt;$(&#039;a[href*=#]&#039;)&lt;/code&gt;. Try &lt;code&gt;$(&#039;a[href*=&quot;#&quot;]&#039;)&lt;/code&gt; instead. Or, you can use &lt;a href=&quot;https://github.com/kswedberg/jquery-smooth-scroll&quot; rel=&quot;nofollow&quot;&gt;the plugin&lt;/a&gt;.]]></description>
		<content:encoded><![CDATA[<p>The problem might be the selector in <code>$('a[href*=#]')</code>. Try <code>$('a[href*="#"]')</code> instead. Or, you can use <a href="https://github.com/kswedberg/jquery-smooth-scroll" rel="nofollow">the plugin</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: three</title>
		<link>http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links/comment-page-1#comment-87429</link>
		<dc:creator>three</dc:creator>
		<pubDate>Thu, 07 Feb 2013 14:04:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links#comment-87429</guid>
		<description><![CDATA[help me. I don&#039;t have a clue beginner here.




$(document).ready(function() {
  function filterPath(string) {
  return string
    .replace(/^\//,&#039;&#039;)
    .replace(/(index&#124;default).[a-zA-Z]{3,4}$/,&#039;&#039;)
    .replace(/\/$/,&#039;&#039;);
  }
  var locationPath = filterPath(location.pathname);
  var scrollElem = scrollableElement(&#039;html&#039;, &#039;&#039;);
 
  $(&#039;a[href*=#]&#039;).each(function() {
    var thisPath = filterPath(this.pathname) &#124;&#124; locationPath;
    if (  locationPath == thisPath
    &amp;&amp; (location.hostname == this.www.tringfernandez.com &#124;&#124; !this.www.tringfernandez)
    &amp;&amp; this.hash.replace(/#/,&#039;&#039;) ) {
      var $target = $(this.hash), target = this.hash;
      if (target) {
        var targetOffset = $target.offset().top;
        $(this).click(function(event) {
          event.preventDefault();
          $(scrollElem).animate({scrollTop: targetOffset}, 400, function() {
            location.hash = target;
          });
        });
      }
    }
  });
 
  // use the first element that is &quot;scrollable&quot;
  function scrollableElement(els) {
    for (var i = 0, argLength = arguments.length; i  0) {
        return el;
      } else {
        $scrollElement.scrollTop(0);
        var isScrollable = $scrollElement.scrollTop()&gt; 0;
        $scrollElement.scrollTop(0);
        if (isScrollable) {
          return el;
        }
      }
    }
    return [];
  }
 
});


I dont know why its stil not making a smooth scroll :(]]></description>
		<content:encoded><![CDATA[<p>help me. I don&#8217;t have a clue beginner here.</p>
<p>$(document).ready(function() {<br />
  function filterPath(string) {<br />
  return string<br />
    .replace(/^\//,&#8221;)<br />
    .replace(/(index|default).[a-zA-Z]{3,4}$/,&#8221;)<br />
    .replace(/\/$/,&#8221;);<br />
  }<br />
  var locationPath = filterPath(location.pathname);<br />
  var scrollElem = scrollableElement(&#8216;html&#8217;, &#8221;);</p>
<p>  $(&#8216;a[href*=#]&#8216;).each(function() {<br />
    var thisPath = filterPath(this.pathname) || locationPath;<br />
    if (  locationPath == thisPath<br />
    &amp;&amp; (location.hostname == this.www.tringfernandez.com || !this.www.tringfernandez)<br />
    &amp;&amp; this.hash.replace(/#/,&#8221;) ) {<br />
      var $target = $(this.hash), target = this.hash;<br />
      if (target) {<br />
        var targetOffset = $target.offset().top;<br />
        $(this).click(function(event) {<br />
          event.preventDefault();<br />
          $(scrollElem).animate({scrollTop: targetOffset}, 400, function() {<br />
            location.hash = target;<br />
          });<br />
        });<br />
      }<br />
    }<br />
  });</p>
<p>  // use the first element that is &#8220;scrollable&#8221;<br />
  function scrollableElement(els) {<br />
    for (var i = 0, argLength = arguments.length; i  0) {<br />
        return el;<br />
      } else {<br />
        $scrollElement.scrollTop(0);<br />
        var isScrollable = $scrollElement.scrollTop()&gt; 0;<br />
        $scrollElement.scrollTop(0);<br />
        if (isScrollable) {<br />
          return el;<br />
        }<br />
      }<br />
    }<br />
    return [];<br />
  }</p>
<p>});</p>
<p>I dont know why its stil not making a smooth scroll :(</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erick</title>
		<link>http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links/comment-page-1#comment-87395</link>
		<dc:creator>Erick</dc:creator>
		<pubDate>Tue, 08 Jan 2013 07:30:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links#comment-87395</guid>
		<description><![CDATA[this is awesome, is there a way to change the smooth scrolling to a kind of fade in effect? (:]]></description>
		<content:encoded><![CDATA[<p>this is awesome, is there a way to change the smooth scrolling to a kind of fade in effect? (:</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karl Swedberg</title>
		<link>http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links/comment-page-1#comment-87284</link>
		<dc:creator>Karl Swedberg</dc:creator>
		<pubDate>Mon, 17 Sep 2012 00:22:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links#comment-87284</guid>
		<description><![CDATA[Yeah, it is a little stupid and ugly, but not nearly as stupid and ugly as the bug that is forcing us to do it in the first place. ;)

As for that line, it&#039;s a fallback script load in case for some reason the jQuery script can&#039;t be loaded from Google&#039;s CDN. If the CDN can&#039;t be reached or times out or something, jQuery will be loaded from a local file instead.]]></description>
		<content:encoded><![CDATA[<p>Yeah, it is a little stupid and ugly, but not nearly as stupid and ugly as the bug that is forcing us to do it in the first place. ;)</p>
<p>As for that line, it&#8217;s a fallback script load in case for some reason the jQuery script can&#8217;t be loaded from Google&#8217;s CDN. If the CDN can&#8217;t be reached or times out or something, jQuery will be loaded from a local file instead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter H.</title>
		<link>http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links/comment-page-1#comment-87283</link>
		<dc:creator>Peter H.</dc:creator>
		<pubDate>Sun, 16 Sep 2012 21:22:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links#comment-87283</guid>
		<description><![CDATA[Karl, thanks a lot for fixed-fix. I couldn&#039;t possibly know whether the hack is ugly or stupid but it certainly works and I&#039;ll certainly use it!
One last question (sorry, there&#039;s always another question): what is this line for?
   !window.jQuery &amp;&amp; document.write(unescape(&#039;%3Cscript src=&quot;../lib/jquery/jquery.js&quot;%3E%3C/script%3E&#039;));
Nothing appears to happen if I delete it, but perhaps it&#039;s there for some other browser that I haven&#039;t tested?]]></description>
		<content:encoded><![CDATA[<p>Karl, thanks a lot for fixed-fix. I couldn&#8217;t possibly know whether the hack is ugly or stupid but it certainly works and I&#8217;ll certainly use it!<br />
One last question (sorry, there&#8217;s always another question): what is this line for?<br />
   !window.jQuery &amp;&amp; document.write(unescape(&#8216;%3Cscript src=&#8221;../lib/jquery/jquery.js&#8221;%3E%3C/script%3E&#8217;));<br />
Nothing appears to happen if I delete it, but perhaps it&#8217;s there for some other browser that I haven&#8217;t tested?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karl Swedberg</title>
		<link>http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links/comment-page-1#comment-87282</link>
		<dc:creator>Karl Swedberg</dc:creator>
		<pubDate>Sun, 16 Sep 2012 17:35:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links#comment-87282</guid>
		<description><![CDATA[The trouble with the naming is that all of the files are referring to position &lt;strong&gt;fixed&lt;/strong&gt;. So, you&#039;re correct, the fixed-fix.html is the one you should use. 

You&#039;ll need to reference jQuery and the jquery.smooth-scroll.js plugin file in your html file. Then you can reference another script file that has the demo code with the &quot;stupid&quot; fix in it. Remember, you don&#039;t need to use the same variable names (e.g. &quot;$stupid&quot; and &quot;mobileHack&quot;) and you don&#039;t need to use the same selector ( &quot;ul.mainnav a&quot; ). Also, I put the demo code in the html file so you can see it if you view source, but you&#039;re better off putting it in a separate file and referencing it like you do the jQuery file and the plugin file. 

Hope that all makes sense.]]></description>
		<content:encoded><![CDATA[<p>The trouble with the naming is that all of the files are referring to position <strong>fixed</strong>. So, you&#8217;re correct, the fixed-fix.html is the one you should use. </p>
<p>You&#8217;ll need to reference jQuery and the jquery.smooth-scroll.js plugin file in your html file. Then you can reference another script file that has the demo code with the &#8220;stupid&#8221; fix in it. Remember, you don&#8217;t need to use the same variable names (e.g. &#8220;$stupid&#8221; and &#8220;mobileHack&#8221;) and you don&#8217;t need to use the same selector ( &#8220;ul.mainnav a&#8221; ). Also, I put the demo code in the html file so you can see it if you view source, but you&#8217;re better off putting it in a separate file and referencing it like you do the jQuery file and the plugin file. </p>
<p>Hope that all makes sense.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter H.</title>
		<link>http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links/comment-page-1#comment-87281</link>
		<dc:creator>Peter H.</dc:creator>
		<pubDate>Sun, 16 Sep 2012 13:08:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links#comment-87281</guid>
		<description><![CDATA[Karl, thanks for such a fast response. The &#039;stupid&#039; fix works on the iPad and I assume on the iPhone too, though I haven&#039;t checked yet. I don&#039;t have an Android device to check on.
I&#039;m not at all knowledgeable about jquery and am like a bull in a china shop when I&#039;m inside a jquery file. So am reluctant to touch anything in there aside from simple controls like speed change. 
I re-downloaded the zip package from your github pages and I&#039;m a little confused about the various files there. The only html page that consistently works on the iPad is the &quot;fixed-fix.html&quot;. The page &quot;fixed.html&quot; seems to exhibit the same problem as before the fix. Should I place your fix code inside script tags at the end of my html page (as in your fixed-fix.html)? Or can it go somewhere inside the &#039;jquery.smooth-scroll.js&#039; file?
One last question: can one use a different easing control apart from &#039;swing&#039;?
Thanks again.]]></description>
		<content:encoded><![CDATA[<p>Karl, thanks for such a fast response. The &#8216;stupid&#8217; fix works on the iPad and I assume on the iPhone too, though I haven&#8217;t checked yet. I don&#8217;t have an Android device to check on.<br />
I&#8217;m not at all knowledgeable about jquery and am like a bull in a china shop when I&#8217;m inside a jquery file. So am reluctant to touch anything in there aside from simple controls like speed change.<br />
I re-downloaded the zip package from your github pages and I&#8217;m a little confused about the various files there. The only html page that consistently works on the iPad is the &#8220;fixed-fix.html&#8221;. The page &#8220;fixed.html&#8221; seems to exhibit the same problem as before the fix. Should I place your fix code inside script tags at the end of my html page (as in your fixed-fix.html)? Or can it go somewhere inside the &#8216;jquery.smooth-scroll.js&#8217; file?<br />
One last question: can one use a different easing control apart from &#8216;swing&#8217;?<br />
Thanks again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karl Swedberg</title>
		<link>http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links/comment-page-1#comment-87279</link>
		<dc:creator>Karl Swedberg</dc:creator>
		<pubDate>Sat, 15 Sep 2012 23:53:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links#comment-87279</guid>
		<description><![CDATA[I came up with an ugly hack that will work around this mobile webkit bug.

* With smooth scroll: http://plugins.learningjquery.com/smooth-scroll/demo/fixed-fix.html
* Without smooth scroll: http://plugins.learningjquery.com/smooth-scroll/demo/fixed-nojs-fix.html]]></description>
		<content:encoded><![CDATA[<p>I came up with an ugly hack that will work around this mobile webkit bug.</p>
<p>* With smooth scroll: <a href="http://plugins.learningjquery.com/smooth-scroll/demo/fixed-fix.html" rel="nofollow">http://plugins.learningjquery.com/smooth-scroll/demo/fixed-fix.html</a><br />
* Without smooth scroll: <a href="http://plugins.learningjquery.com/smooth-scroll/demo/fixed-nojs-fix.html" rel="nofollow">http://plugins.learningjquery.com/smooth-scroll/demo/fixed-nojs-fix.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karl Swedberg</title>
		<link>http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links/comment-page-1#comment-87277</link>
		<dc:creator>Karl Swedberg</dc:creator>
		<pubDate>Sat, 15 Sep 2012 16:45:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links#comment-87277</guid>
		<description><![CDATA[Hi Peter, 

I definitely see the problem you&#039;re referring to, and I can&#039;t figure out what is going on there. In fact, I see the same exact problem on a page where &lt;strong&gt;no JavaScript is included at all&lt;/strong&gt;. For example, check out this page: 

http://plugins.learningjquery.com/smooth-scroll/demo/fixed-no-ss.html

Do you see the same problem there on iOS?

I&#039;m investigating.]]></description>
		<content:encoded><![CDATA[<p>Hi Peter, </p>
<p>I definitely see the problem you&#8217;re referring to, and I can&#8217;t figure out what is going on there. In fact, I see the same exact problem on a page where <strong>no JavaScript is included at all</strong>. For example, check out this page: </p>
<p><a href="http://plugins.learningjquery.com/smooth-scroll/demo/fixed-no-ss.html" rel="nofollow">http://plugins.learningjquery.com/smooth-scroll/demo/fixed-no-ss.html</a></p>
<p>Do you see the same problem there on iOS?</p>
<p>I&#8217;m investigating.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter H.</title>
		<link>http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links/comment-page-1#comment-87275</link>
		<dc:creator>Peter H.</dc:creator>
		<pubDate>Fri, 14 Sep 2012 09:39:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links#comment-87275</guid>
		<description><![CDATA[Hello Karl, thanks for all your work on this script - very nice.

One problem, which nowadays with so much mobile use really makes this script almost unusable, on iOS with a &#039;position: fixed;&#039; div for the navigation menu, you lose clickability after the first scroll, until you manually scroll with a finger touch, then you can click-scroll again once only.

I&#039;m sure you already know about this but I was wondering if you have plans to work on it?]]></description>
		<content:encoded><![CDATA[<p>Hello Karl, thanks for all your work on this script &#8211; very nice.</p>
<p>One problem, which nowadays with so much mobile use really makes this script almost unusable, on iOS with a &#8216;position: fixed;&#8217; div for the navigation menu, you lose clickability after the first scroll, until you manually scroll with a finger touch, then you can click-scroll again once only.</p>
<p>I&#8217;m sure you already know about this but I was wondering if you have plans to work on it?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Database Caching 12/24 queries in 0.009 seconds using disk: basic
Object Caching 381/393 objects using disk: basic
Content Delivery Network via learningjquery.kswedberg.netdna-cdn.com

 Served from: www.learningjquery.com @ 2013-05-18 19:33:43 by W3 Total Cache -->