Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 1.02 KB | None | 0 0
  1. $(document).ready(function(){
  2.  
  3.   // ancres douces
  4.   $('a').on('click',function(){
  5.     let cible = $(this).attr('#hautpage');
  6.     if(cible.substr(0,1) == '#'){
  7.       $('html,body')
  8.         .stop()
  9.         .animate({scrollTop : $(cible).offset().top - 80 },700);
  10.     }
  11.   });
  12.  
  13.  
  14.  
  15.  
  16.   let hauteurDocument = $(document).height();
  17.  
  18.   let indicateur=false;
  19.  
  20.   $(window).scroll(function(){
  21.    
  22.     if ( $(window).scrollTop() > 60 ){
  23.       $('#remonte').show();
  24.     }else{
  25.       $('#remonte').hide();
  26.     }
  27.     hauteurScroll = $(window).scrollTop();
  28.     hauteurFenetre = $(window).height();
  29.     pourcentageParcouru = hauteurScroll * 100 / (hauteurDocument - hauteurFenetre);
  30.  
  31.     if (pourcentageParcouru > 50 && indicateur === false ){
  32.        $('main,header,footer').fadeTo(500,0.3);
  33.        $('#message').slideDown(500);
  34.        indicateur = true;
  35.     }
  36.   });
  37.  
  38.   $('#close').on('click',function(e){
  39.     e.preventDefault();
  40.     $('main,header,footer').fadeTo(500,1);
  41.     $('#message').slideUp(500);
  42.   });
  43.  
  44. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement