Well, this is a performance issue that I assume.
I have a slider with two navigation links (next and previous), and when the slider gets to the end of the line, I currently disable the next button and then snap again when it goes in the other direction. I perform the same operation for the next button, but cancel.
The code for the next button will look something like this:
if (at end of slider) {
nextBtn.unbind("click")
} else if (not already bound) {
nextBtn.bind("click",clickHandler)
}
So ... Is it better to do this or to have a condition in the click handler to check $.data(nextBtn,"state","on")or$.data(nextBtn,"state","off")
source
share