I am sure this is easy but I’ve looked all over with no luck. I have written a paging jQuery script that animates a list on my page. I have next and previous buttons which I am showing/hiding depending on where you are in the list however it doesnt pick up the position change the first time. Here is my code in jsFiddle:
http://jsfiddle.net/mikeoram/t4787/
I’m sure I’m only missing something simple, all suggestions would be helpful.
Please only answer my question, there are reasons I’m doing it the way I am, and i no it can be done differently.
Thanks,
Mike
First of all,
topis a reserved variable that refers to the top window in the hierarchy. Always declare the variables inside functions so it doesn’t mess with the rest of your code:Second, use regex to remove the non digits from the top value, so it will always be a valid integer:
See this http://jsfiddle.net/MaLDK/1/