$(window).load(function() {
var paircount = 0;
var $thisSprite = $("#%id% img.imageStyle");
if ($.browser.msie)
{
// I need this only if desaturate png with aplha channel
$thisSprite = $thisSprite.desaturateImgFix();
}
// modified not to desaturate the clone
$thisSprite.each(function(){
$(this).addClass("%id%")
.clone()
.attr('id', '')
.addClass('color')
.hide()
.insertAfter($(this))
});
// desaturate all occourances
$thisSprite = $thisSprite.desaturate();
// Need to remove this instance of the desaturated origonal below on hover
// currently shows both on hover...???????????
// add events for switch between color/gray versions
$('.centered_image').bind('mouseenter mouseleave', function(e){
$(this).find('img').toggle().toggleClass('color');
});
});
Новый тест на http://www.doobox.co.uk/test/test.htmlГде добавить jquery "this"?
сердечным приветом
Гэри.
Пожалуйста, добавьте содержимое функции desevent. Я думаю, что это может помочь лучше объяснить, что происходит. – BBonifield
Это похоже на очень неэффективный метод переключения изображений. Вы пытались использовать 'toggleClass' (http://api.jquery.com/toggleClass/) вместо того, чтобы клонировать изображение и скрывать и показывать их? – Mottie
@ BBonifield, добавил полный файл js для просмотра – Doobox