I'm trying to create a sort of "virtual gallery". I'm using Coda Slider 2.0 & jQuery v1.4.2
It behaves perfectly in IE, FF & Safari, but Chrome seems to reload/hang for a second when setting location.hash. This causes the jQuery animation to freeze for a second :S
Example: http://hardyernst.dk/gallery.html try clicking on the navigation links above the pictures.
The jQuery code that is being executed when clicking a navigation link:
$('#coda-nav-' + sliderCount + ' a').each(function(z) {
// What happens when a nav link is clicked
$(this).bind("click", function() {
offset = -(panelWidth*z);
navClicks++;
$(this).addClass('current').parents('ul').find('a').not($(this)).removeClass('current');
alterPanelHeight(z);
currentPanel = z + 1;
$('.panel-container', slider).stop().animate({ left: offset }, settings.slideEaseDuration, settings.slideEaseFunction, function(){
if (!settings.crossLinking) { return false; } // Don't change the URL hash unless cross-linking is specified
});
});
});
if I add
return false;
at the end of the function. The animation will slide smoothly :)... BUT as you might have guessed the location.hash value remains unchanged :(
I have tried setting the location.hash earlier in the function alas it did not change the behavior in Chrome
Would be immensely grateful for any help :)
Regards Ubunut
edit: So now i moved location.hash into the animation callback, it's a lot smoother :) but if you click two nav-links rapidly after each other the animation will hang/freeze momentarily (just like before). I could add a jQuery .delay() but i'd rather not do it that way. Any suggestions?