function getScrollMaxY() { var innerh; if (window.innerHeight) { innerh = window.innerHeight; } else { innerh = document.body.clientHeight; } if (window.innerHeight && window.scrollMaxY) { // Firefox yWithScroll = window.innerHeight + window.scrollMaxY; } else if ( document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac yWithScroll = document.body.scrollHeight; } else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari yWithScroll = document.body.offsetHeight; } return yWithScroll - innerh; } jQuery(document).ready(function (jQuery) { jQuery(window).unload(function () { return; }); // unload jQuery(window).load(function () { if (jQuery("#scrolltotop").length == 0) jQuery('#scrolltobottom').before('
'); stb = jQuery('#scrolltobottom'); stt = jQuery('#scrolltotop'); stt.css('opacity', 1) stb.css('opacity', 1) jQuery('#scrolltotop').height(100); jQuery('#scrolltobottom').height(100); jQuery('#scrolltotop').css({ }); jQuery('#scrolltobottom').css({ }); jQuery(window).resize( function (event, ui) { jQuery(window).scroll(); }); jQuery('.auto_details').text(" "); wmax = jQuery("body").height() - jQuery(window).height(); scrollTop = jQuery(window).scrollTop(); pourcent = (scrollTop / wmax); jQuery(stt).css({ opacity: pourcent }); jQuery(stb).css({ opacity: 1 - pourcent }); //=================================================== jQuery(window).scroll(function () { maxi = getScrollMaxY(); wmax = jQuery("body").height() - jQuery(window).height(); scrollTop = jQuery(window).scrollTop(); pourcent = (scrollTop / wmax); jQuery(stt).css({ opacity: pourcent }); jQuery(stb).css({ opacity: 1 - pourcent }); jQuery("#scrollmiddle").css("bottom", maxi + "px"); // jQuery("#scrollmiddle").text(pourcent); //==================================================== scrollBottom = jQuery(window).scrollTop(); }); //===================================================== jQuery('#scrolltobottom a').mouseover(function () { wmax = jQuery("body").height() - jQuery(window).height(); scrollTop = jQuery(window).scrollTop(); pourcent = (scrollTop / wmax); stb.stop().fadeTo(500, 1 - pourcent); }); jQuery('#scrolltobottom a').mouseout(function () { stb.stop().fadeTo(500, 0); }); jQuery('#scrolltotop a').mouseover(function () { wmax = jQuery("body").height() - jQuery(window).height(); scrollTop = jQuery(window).scrollTop(); pourcent = (scrollTop / wmax); stt.stop().fadeTo(500, pourcent); }); jQuery('#scrolltotop a').mouseout(function () { stt.stop().fadeTo(500, 0); }); jQuery('#scrolltobottom a').click(function () { pos = jQuery("body").height() - jQuery(window).height(); ; jQuery('html, body').animate({ scrollTop: pos + 'px' }, 1000, function () { }); }); jQuery('#scrolltotop a').click(function () { pos = 0; jQuery('html, body').animate({ scrollTop: pos + 'px' }, 0, function () { }); }); //=================================================================== }); }); //=========================================================