1 var scrolltotop={ 2 //startline: Integer. Number of pixels from top of doc scrollbar is scrolled before showing control 3 //scrollto: Keyword (Integer, or "Scroll_to_Element_ID"). How far to scroll document up when control is clicked on (0=top). 4 setting: {startline:100, scrollto: 0, scrollduration:1000, fadeduration:[500, 100]}, 5 controlHTML: '',//<img src=\"exemples/scrolltop/retourhaut.png\" style=\"filter:alpha(opacity=70); -moz-opacity:0.7; width:40px; height:40px\" />', //HTML for control, which is auto wrapped in DIV w/ ID="topcontrol" 6 controlattrs: {offsetx:35, offsety:60}, //offset of control relative to right/ bottom of window corner 7 anchorkeyword: '#haut', //Enter href value of HTML anchors on the page that should also act as "Scroll Up" links 8 9 state: {isvisible:false, shouldvisible:false}, 10 11 scrollup:function(){ 12 if (!this.cssfixedsupport) //if control is positioned using JavaScript 13 this.$control.css({opacity:0}) //hide control immediately after clicking it 14 var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto) 15 if (typeof dest=="string" && jQuery('#'+dest).length==1) //check element set by string exists 16 dest=jQuery('#'+dest).offset().top 17 else 18 dest=0 19 this.$body.animate({scrollTop: dest}, this.setting.scrollduration); 20 }, 21 22 23 24 25 26 keepfixed:function(){ 27 var $window=jQuery(window) 28 var controlx=$window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx 29 var controly=$window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety 30 this.$control.css({left:controlx+'px', top:controly+'px'}) 31 }, 32 33 togglecontrol:function(){ 34 var scrolltop=jQuery(window).scrollTop() 35 if (!this.cssfixedsupport) 36 this.keepfixed() 37 this.state.shouldvisible=(scrolltop>=this.setting.startline)? true : false 38 if (this.state.shouldvisible && !this.state.isvisible){ 39 this.$control.stop().animate({opacity:1}, this.setting.fadeduration[0]) 40 this.state.isvisible=true 41 } 42 else if (this.state.shouldvisible==false && this.state.isvisible){ 43 this.$control.stop().animate({opacity:0}
43, this.setting.fadeduration[1]) 44 this.state.isvisible=false 45 } 46 }, 47 48 init:function(){ 49 jQuery(document).ready(function($){ 50 var mainobj=scrolltotop 51 var iebrws=document.all 52 mainobj.cssfixedsupport=!iebrws || iebrws && document.compatMode=="CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode 53 mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body') 54 mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+'</div>') 55 .css({position:mainobj.cssfixedsupport? 'fixed' : 'absolute', bottom:mainobj.controlattrs.offsety, right:mainobj.controlattrs.offsetx, opacity:0, cursor:'pointer'}) 56 .attr({title:'back to top'}) 57 .click(function(){mainobj.scrollup(); return false}) 58 .appendTo('body') 59 if (document.all && !window.XMLHttpRequest && mainobj.$control.text()!='') //loose check for IE6 and below, plus whether control contains any text 60 mainobj.$control.css({width:mainobj.$control.width()}) //IE6- seems to require an explicit width on a DIV containing text 61 mainobj.togglecontrol() 62 $('a[href="' + mainobj.anchorkeyword +'"]').click(function(){ 63 mainobj.scrollup() 64 return false 65 }) 66 $(window).bind('scroll resize', function(e){ 67 mainobj.togglecontrol() 68 }) 69 }) 70 } 71 } 72 73 scrolltotop.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.