Tuesday 13 May 2014

How to Create "Back to TOP" Floating Button for your Blogger.


I told you about how to create drop down Menu in last article.Now i will tell you about the creation of Back t Top Button widget. Its Very Useful for Bloggers to create a Back to Top or Go to Top Floating Button for their website.Yes You can do it with very easy steps given below from Emerging Bloggers . 

Just follow the instructions Below !

Go to Blogger Dashboard >Layout>Add gadget>Past below code to HTML saver.



<a href='http://www2.emerging-bloggers.com'><img alt='Bhakkartv' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg48o6zYPoxuCzDHgD82vcbeb8rP2kLsKtXRus8JoC7YtIvXX-HUoqkzvfBdsIg9BTfvej5Rl9nEF-2xsv8ZIXIhe4eAuH8Tk5OIQmzcR1uVh8KxdwtgW-RqYu07mQYBws0VzHMyAt2GhMe/s1600/best+blogger+tips.png'/></a><script type="text/JavaScript">
var topMargin = 300
var slideTime = 1200
var ns6 = (!document.all && document.getElementById);
var ie4 = (document.all);
var ns4 = (document.layers);
window.setInterval("main()", 10)

function floatObject() {
if (ns4 || ns6) {
findHt = window.innerHeight;
} else if(ie4) {
findHt = document.body.clientHeight;
}
}

function main() {
if (ns4) {
this.currentY = document.floatLayer.top;
this.scrollTop = window.pageYOffset;
mainTrigger();
} else if(ns6) {
this.currentY = parseInt(document.getElementById('floatLayer').style.top);
this.scrollTop = scrollY;
mainTrigger();
} else if(ie4) {
this.currentY = floatLayer.style.pixelTop;
this.scrollTop = document.body.scrollTop;
mainTrigger();
}

}
function mainTrigger() {
var newTargetY = this.scrollTop + this.topMargin
if ( this.currentY != newTargetY ) {
if ( newTargetY != this.targetY ) {
this.targetY = newTargetY
floatStart();
}
animator();
}


}
function floatStart() {
var now = new Date()
this.A = this.targetY - this.currentY
this.B = Math.PI / ( 2 * this.slideTime )
this.C = now.getTime()
if (Math.abs(this.A) > this.findHt) {
this.D = this.A > 0 ? this.targetY - this.findHt : this.targetY + this.findHt
this.A = this.A > 0 ? this.findHt : -this.findHt
} else {
this.D = this.currentY
}
}
function animator() {
var now = new Date()
var newY = this.A * Math.sin( this.B * ( now.getTime() - this.C ) ) + this.D
newY = Math.round(newY)
if (( this.A > 0 && newY > this.currentY ) || ( this.A < 0 && newY < this.currentY )) {
if ( ie4 )floatLayer.style.pixelTop = newY
if ( ns4 )document.floatLayer.top = newY
if ( ns6 )document.getElementById('floatLayer').style.top = newY + "px"
}
}
//-->
</script>
<div id="floatLayer" style="position: absolute; height:20px; width:20; left:650px; top:300px; z-index: 100"><a href="#"><img vspace="0" border="0" hspace="0" alt="Back to Top" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh82tmC2s5AXio2HJWC4_XCYTVTWxKUxG5Z3w-o1KoOiwwO_94Hk-_2En-6nzmsz8_sjjEl7Nx_JI6RWpVAaVuE_7a7HWJaDO2XatQDNxBpRHqWniXJZt9a5qp4JjsphxeWwBQo6K_AeY5q/s1600/TOP+BUTTON.gif" title="Back To Top Of Page" /></a></div>

No comments:

Post a Comment