jquery - javascript onscroll fade same class but with different div -


i new @ javascript , want learn new.

there wrong code : why div fades @ same time.

i want ask how fade different divs same class name.can me , explain me.

thanks in advance.

javascript:

$(window).scroll(function(){   if ($( "div.fade" ).offset().top - $(window).scrolltop() <= 100){        $('.fade').addclass( "fade-in");   }   else {        $('.fade').removeclass("fade-in");   } }); 

here jsfiddle

onscroll = function () {     var scrolltop = $(this).scrolltop() ;      $("div.fade").each(function(){          if(($(this).offset().top - scrolltop) <= 100){             $(this).toggleclass("fade-in");          }     }) } 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -