How we can run function only once inside scroll() in jquery

Viewed 36

I have a code inside a scroll function, want to run it only once.How can I achieve it.

$(document).ready(function(){
 $(window).scroll(function(){
  ('.bar').each(function(){
   //some code
  });
 });
});

here each function is running again and again as I scroll. What change should I do to run it only once. Thank You in advance.

0 Answers
Related