Create "Back To Top" Gadgets with jQuery

jQuery Logo
Gadgets For Blogger - Previously I've posted an article about Back to Top course, but this time with slightly different edits of the jquery script. Difference with this script is more subtle, means the movement from bottom to top (Top) using phase stage slowly but surely haha. This script is the same function as Tools Firefox shift scroll smoothly.

Let's look at the way this script blog.

• Go to blogger.com with a password and id

• Open design or design Html → Edit → Expand Widget Centrang

• Find the code </ head> and place the following code above the code </ head>


<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' type='text/javascript'></script>
<script type='text/javascript'>
$(function(){
$(&#39;a[href*=#top]&#39;).click(function() {
if (location.pathname.replace(/^//,&#39;&#39;) == this.pathname.replace(/^//,&#39;&#39;)
&amp;&amp; location.hostname == this.hostname) {
var $target = $(this.hash);
$target = $target.length &amp;&amp; $target || $(&#39;[name=&#39; + this.hash.slice(1) +&#39;]&#39;);
if ($target.length) {
var targetOffset = $target.offset().top;
$(&#39;html,body&#39;).animate({scrollTop: targetOffset}, 1000);
return false;
}
}
});
});
</script>


• Find <body> code and change the code to <body id='top'>

• Place the following code above the code </ body> is usually located at the very bottom of the template


<div id='gotop'>
<a href='#top' title='Go to Top'>
<img src='http://i1042.photobucket.com/albums/b429/Farix_2010/FarixTop.png' style='right:20px;bottom:20px;position:fixed'/>
</a>
</div>


Change the green code as the image url as needed.

• Save the template and have completed tutorial about Back to TOP Gadgets with jQuery.
Source: farixsantips - Gadgets For Blogger



0 comments:

Post a Comment