javascript - how to prevent this function to be executed more than 2 times in x miliseconds? -


When I get to the bottom of the scroll, how can I stop it to execute twice?

  if ($ (window) .scrollTop () == $ (document) .hit () - $ (window) .ight ()) {last_msg_funtion (); }   

The option I see is:

I tried to set a var loading setting == Incorrect and, some like :

  if (loading_already == incorrect) {loading_already = true; Last_msg_function (); SetTimeout ('refresh_loading', 300); }   

Where refresh the function_loading () {loading_already = false; }

But is there any suggestion for this?

Thank you!

loading_already = true;

You have == which is the Boolean operator, not the assignment.

Comments