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