Stop keydown scrolling from bubbling
I'm trying to make a slider which goes left and right with the keydown function and replaces a div with content specific to each li. However when yo开发者_高级运维u press the keys too fast in succession then sometimes content either doesn't show or repeats itself as well as the events bubbling up. I've tried a few methods but nothing really works. The URL is http://jackjamesmartin.ninoharris.com/
var wait = false;
function theEvent(){
if(wait){
return;
}
wait = true;
do somthing
//You need to make sure that this is in the callbacks, ie all events are complete.
wait = false;
// or setTimeout(function(){wait = false}, xxx )
}
精彩评论