javascript - scrollTop duplicating values each time function is called -


i have 2 divs each time 1 of them clicked scrolls down common content div called .nbm_specs. first time click scrolls correctly, subsequent clicks make scrolling go crazy , keeps scrolling small amount each time. acting stacking offset top each time click on it.

i have established scroll in function call in each .on click function.

//hidel @ start     $(".prostar,.x10,.x20,.x23,.x30,.x46,.xstar").fadeout(0);   //scrol when clicekd  function specscrol(){     $('html, body').animate({     scrolltop: $(".nbm_specs").offset().top -80}, 1500); }  //navigation section models $("#prostar").on('click', function() {    $(".prostar").fadein(0);    $(".x10").fadeout(0);     specscrol();   });  $("#x10").on('click', function() {    $(".x10").fadein(0);    $(".prostar").fadeout(0);    specscrol(); }); 

thanks in advance

solved.

the issue there multiple .nbm_specs div , code wasn't sure go , getting confused. fixed creating blank div above .nbm_specs div unique id.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -