I have a jquery code that is moving up and down continuously a div containing a list with logos. The animation is repeating within a set interval and is all seems to be working as expected in Chrome, FireFox and IE 9 and 8 (no console errors).
However in IE7 I get 'script error' and the browser totally freezes... I think the setInterval and clearInterval are not working properly or i have messed up my code...
Here it is:
//<!------------------LOGOS ------------------>
// the automatic scroll start immediately
$(document).ready(function () { membersLogos() });
// set the interval after which to restart the animated scroll
$(function () {
var intervalID;
var resetTimer = function () {
if (intervalID) { clearInterval(intervalID) };
intervalID = setInterval(function () {
membersLogos();
}, 190000);
};
});
// set the interval after which to restart the animated scroll
function membersLogos() {
var pane = $('#mypane');
if ($('#mypane').length) {
pane.jScrollPane({
animateScroll: true, //added
animateDuration: 95000, //added - length each way in milliseconds
stickToTop: true,
//autoReinitialise: true,
enableKeyboardNavigation: true
});
var api = pane.data('jsp');
var logosHeight = parseInt($('#mypane .jspPane').height());
//listen to the x-axis scrolling event
pane.bind('jsp-scroll-y', function (event, pos_y, at_top, at_bottom) {
//we're at the bottom now lets scroll back to the top
if (at_bottom) {
api.scrollToY(0);
$(this).unbind(event); //added with edit
$(this).bind('jsp-scroll-y', function (event, pos_y, at_top, at_bottom) {
if (at_top) {
$(this).unbind(event);
api.scrollToY(logosHeight);
}
});
}
});
//initial animate scroll to the top
api.scrollToY(logosHeight);
}
}
Any ideas or suggestions as what is wrong? Thanks in advance! Vik