Having an issue with the jquery .hover function. I am only able to get it to work if I wrap it in a generic $(function(){ I have seen it done without needing this generic function, if anyone can see what i am doing wrong I would appreciate it.
This does not Work:
$('#slider > img').hover(function () {
stopLoop();
}, function () {
startSlider();
});
This does work:
$(function () {
$('#slider > img').hover(function () {
stopLoop();
}, function () {
startSlider();
});
});
document.ready.generic function. That's tying it to the document being ready (which is what you want to do). Keep doing it the second way.$('#slider > img')that element/s is/are not yet on the DOM$('#slider > img').hover(stopLoop, startSlider);