1/*********************************************** 2* Scroll To Top Control script- � Dynamic Drive DHTML code library (www.dynamicdrive.com) 3* Modified by www.MyBloggerTricks.com 4* Modified by www.scrolltotop.com 5* This notice MUST stay intact for legal use 6* Visit Project Page at http://www.dynamicdrive.com for full source code 7***********************************************/ 8 9 10var scrolltotop={ 11 12 //startline: Integer. Number of pixels from top of doc scrollbar is scrolled before showing control 13 14 //scrollto: Keyword (Integer, or "Scroll_to_Element_ID"). How far to scroll document up when control is clicked on (0=top). 15 16 setting: {startline:100, scrollto: 0, scrollduration:1000, fadeduration:[500, 100]}, 17 18 controlHTML: '<img src="/css/images/arrow79.png" />', //HTML for control, which is auto wrapped in DIV w/ ID="topcontrol" 19 20 controlattrs: {offsetx:5, offsety:55}, //offset of control relative to right/ bottom of window corner 21 22 anchorkeyword: '#top', //Enter href value of HTML anchors on the page that should also act as "Scroll Up" links 23 24 state: {isvisible:false, shouldvisible:false}, 25 26 27 scrollup:function(){ 28 29 if (!this.cssfixedsupport) //if control is positioned using JavaScript 30 31 this.$control.css({opacity:0}) //hide control immediately after clicking it 32 33 var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto) 34 35 if (typeof dest=="string" && jQuery('#'+dest).length==1) //check element set by string exists 36 37 dest=jQuery('#'+dest).offset().top 38 39 else 40 41 dest=0 42 43 this.$body.animate({scrollTop: dest}, this.setting.scrollduration); 44 45 }, 46 47 48 keepfixed:function(){ 49 50 var $window=jQuery(window) 51 52 var controlx=$window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx 53 54 var controly=$window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety 55 56 this.$control.css({left:controlx+'px', top:controly+'px'}) 57 58 }, 59 60 61 togglecontrol:function(){ 62 63 64 65 var scrolltop=jQuery(window).scrollTop() 66 67 if (!this.cssfixedsupport) 68 69 this.keepfixed() 70 71 this.state.shouldvisible=(scrolltop>=this.setting.startline)? true : false 72 73 if (this.state.shouldvisible && !this.state.isvisible){ 74 75 this.$control.stop().animate({opacity:1}, this.setting.fadeduration[0]) 76 77 this.state.isvisible=true 78 79 } 80 81 else if (this.state.shouldvisible==false && this.state.isvisible){ 82 83 this.$control.stop().animate({opacity:0}
83, this.setting.fadeduration[1]) 84 85 this.state.isvisible=false 86 87 } 88 }, 89 90 init:function(){ 91 jQuery(document).ready(function($){ 92 var mainobj=scrolltotop 93 var iebrws=document.all 94 mainobj.cssfixedsupport=!iebrws || iebrws && document.compatMode=="CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode 95 mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body') 96 mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+'</div>') 97 .css({position:mainobj.cssfixedsupport? 'fixed' : 'absolute', bottom:mainobj.controlattrs.offsety, right:mainobj.controlattrs.offsetx, opacity:0, cursor:'pointer'}) 98 .attr({title:'Scroll to Top'}) 99 .click(function(){mainobj.scrollup(); return false}) 100 .appendTo('body') 101 if (document.all && !window.XMLHttpRequest && mainobj.$control.text()!='') //loose check for IE6 and below, plus whether control contains any text 102 mainobj.$control.css({width:mainobj.$control.width()}) //IE6- seems to require an explicit width on a DIV containing text 103 mainobj.togglecontrol() 104 105$('a[href="' + mainobj.anchorkeyword +'"]').click(function(){ 106 mainobj.scrollup() 107 return false 108 }) 109 $(window).bind('scroll resize', function(e){ 110 mainobj.togglecontrol() 111 }) 112 }) 113 } 114} 115scrolltotop.init()
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.