From 09fbe4c3442af2689b1ec7e540cd87a282c01123 Mon Sep 17 00:00:00 2001 From: shadlaws Date: Mon, 25 Feb 2013 17:13:10 +0100 Subject: #2018 - Make ui.init.js thumbnail hover effect more robust. - changed thumbnail hover effect to store its original height on mouseenter, then return to it on mouseleave. - removed previous routine which depended on the height of its siblings and was incompatible with some IE versions. --- themes/wind/js/ui.init.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'themes/wind/js/ui.init.js') diff --git a/themes/wind/js/ui.init.js b/themes/wind/js/ui.init.js index 5a83c015..c9f9202c 100644 --- a/themes/wind/js/ui.init.js +++ b/themes/wind/js/ui.init.js @@ -54,6 +54,8 @@ $(document).ready(function() { // Initialize thumbnail hover effect $(".g-item").hover( function() { + // Store original height so we can change it back afterward + $(this).attr("data-orig-height", $(this).height()); // Insert a placeholder to hold the item's position in the grid var placeHolder = $(this).clone().attr("id", "g-place-holder"); $(this).after($(placeHolder)); @@ -77,17 +79,12 @@ $(document).ready(function() { }, function() { // Reset item height and position - if ($(this).next().height()) { - var sib_height = $(this).next().height(); - } else { - var sib_height = $(this).prev().height(); - } - $(this).css("height", sib_height); + $(this).css("height", $(this).attr("data-orig-height")); $(this).css("position", "relative"); $(this).css("top", 0).css("left", 0); // Remove the placeholder and hover class from the item $(this).removeClass("g-hover-item"); - $(this).gallery_valign(); + $(this).gallery_valign(); $("#g-place-holder").remove(); } ); @@ -95,7 +92,7 @@ $(document).ready(function() { // Realign any thumbnails that change so that when we rotate a thumb it stays centered. $(".g-item").bind("gallery.change", function() { $(".g-item").each(function() { - $(this).height($(this).find("img").height() + 2); + $(this).height($(this).find("img").height() + 2); }); $(".g-item").equal_heights().gallery_valign(); }); -- cgit v1.2.3