[11961] | 1 | function getScrollMaxY() { |
---|
| 2 | var innerh; |
---|
| 3 | if (window.innerHeight) { |
---|
| 4 | innerh = window.innerHeight; |
---|
| 5 | } else { |
---|
| 6 | innerh = document.body.clientHeight; |
---|
| 7 | } |
---|
| 8 | if (window.innerHeight && window.scrollMaxY) { |
---|
| 9 | // Firefox |
---|
| 10 | yWithScroll = window.innerHeight + window.scrollMaxY; |
---|
| 11 | } else if ( |
---|
| 12 | document.body.scrollHeight > document.body.offsetHeight) { |
---|
| 13 | // all but Explorer Mac |
---|
| 14 | yWithScroll = document.body.scrollHeight; |
---|
| 15 | } else { |
---|
| 16 | // works in Explorer 6 Strict, Mozilla (not FF) and Safari |
---|
| 17 | yWithScroll = document.body.offsetHeight; |
---|
| 18 | } |
---|
| 19 | return yWithScroll - innerh; |
---|
[18716] | 20 | } |
---|
| 21 | |
---|
| 22 | |
---|
[11961] | 23 | jQuery(document).ready(function (jQuery) { |
---|
[22467] | 24 | jQuery(window).on("load", function () { |
---|
[11961] | 25 | if (jQuery("#scrolltotop").length == 0) |
---|
| 26 | jQuery('#scrolltobottom').before('<div id="scrolltotop" ><a title="Revenir en haut de la page" href="#"></a></div>'); |
---|
[11912] | 27 | |
---|
[18716] | 28 | stb = jQuery('#scrolltobottom'); |
---|
| 29 | stt = jQuery('#scrolltotop'); |
---|
[22218] | 30 | stt.css('opacity', 1); |
---|
| 31 | stb.css('opacity', 1); |
---|
[11912] | 32 | |
---|
[11961] | 33 | jQuery('#scrolltotop').height(100); |
---|
| 34 | jQuery('#scrolltobottom').height(100); |
---|
| 35 | jQuery('#scrolltotop').css({ |
---|
[18716] | 36 | }); |
---|
| 37 | jQuery('#scrolltobottom').css({ |
---|
| 38 | }); |
---|
| 39 | jQuery(window).resize( |
---|
[11961] | 40 | function (event, ui) { |
---|
| 41 | jQuery(window).scroll(); |
---|
| 42 | }); |
---|
[18716] | 43 | jQuery('.auto_details').text(" "); |
---|
[11442] | 44 | |
---|
[18716] | 45 | wmax = jQuery("body").height() - jQuery(window).height(); |
---|
| 46 | scrollTop = jQuery(window).scrollTop(); |
---|
| 47 | pourcent = (scrollTop / wmax); |
---|
| 48 | jQuery(stt).css({ opacity: pourcent }); |
---|
| 49 | jQuery(stb).css({ opacity: 1 - pourcent }); |
---|
[11442] | 50 | |
---|
[18716] | 51 | //=================================================== |
---|
| 52 | jQuery(window).scroll(function () { |
---|
| 53 | maxi = getScrollMaxY(); |
---|
| 54 | wmax = jQuery("body").height() - jQuery(window).height(); |
---|
| 55 | scrollTop = jQuery(window).scrollTop(); |
---|
| 56 | pourcent = (scrollTop / wmax); |
---|
[11442] | 57 | |
---|
| 58 | |
---|
[18716] | 59 | jQuery(stt).css({ opacity: pourcent }); |
---|
| 60 | jQuery(stb).css({ opacity: 1 - pourcent }); |
---|
[11961] | 61 | |
---|
| 62 | |
---|
[18716] | 63 | jQuery("#scrollmiddle").css("bottom", maxi + "px"); |
---|
| 64 | // jQuery("#scrollmiddle").text(pourcent); |
---|
| 65 | //==================================================== |
---|
| 66 | scrollBottom = jQuery(window).scrollTop(); |
---|
[11961] | 67 | |
---|
[18716] | 68 | }); |
---|
| 69 | //===================================================== |
---|
| 70 | jQuery('#scrolltobottom a').mouseover(function () { |
---|
| 71 | wmax = jQuery("body").height() - jQuery(window).height(); |
---|
| 72 | scrollTop = jQuery(window).scrollTop(); |
---|
| 73 | pourcent = (scrollTop / wmax); |
---|
[11961] | 74 | |
---|
[18716] | 75 | stb.stop().fadeTo(500, 1 - pourcent); |
---|
[11961] | 76 | |
---|
[18716] | 77 | }); |
---|
| 78 | jQuery('#scrolltobottom a').mouseout(function () { |
---|
| 79 | stb.stop().fadeTo(500, 0); |
---|
[11961] | 80 | |
---|
[18716] | 81 | }); |
---|
| 82 | jQuery('#scrolltotop a').mouseover(function () { |
---|
| 83 | wmax = jQuery("body").height() - jQuery(window).height(); |
---|
| 84 | scrollTop = jQuery(window).scrollTop(); |
---|
| 85 | pourcent = (scrollTop / wmax); |
---|
| 86 | stt.stop().fadeTo(500, pourcent); |
---|
[11442] | 87 | |
---|
[18716] | 88 | }); |
---|
| 89 | jQuery('#scrolltotop a').mouseout(function () { |
---|
| 90 | stt.stop().fadeTo(500, 0); |
---|
| 91 | }); |
---|
[11912] | 92 | |
---|
[18716] | 93 | jQuery('#scrolltobottom a').click(function () { |
---|
| 94 | pos = jQuery("body").height() - jQuery(window).height(); ; |
---|
| 95 | jQuery('html, body').animate({ |
---|
| 96 | scrollTop: pos + 'px' |
---|
| 97 | }, 1000, function () { |
---|
| 98 | |
---|
| 99 | }); |
---|
[11442] | 100 | }); |
---|
| 101 | |
---|
[18716] | 102 | jQuery('#scrolltotop a').click(function () { |
---|
| 103 | pos = 0; |
---|
| 104 | jQuery('html, body').animate({ |
---|
| 105 | scrollTop: pos + 'px' |
---|
| 106 | }, 0, function () { |
---|
[11961] | 107 | |
---|
| 108 | |
---|
[18716] | 109 | }); |
---|
[11442] | 110 | }); |
---|
[18716] | 111 | //=================================================================== |
---|
[11442] | 112 | |
---|
| 113 | |
---|
| 114 | |
---|
[18716] | 115 | }); |
---|
[11442] | 116 | }); |
---|
| 117 | //========================================================= |
---|
| 118 | |
---|