Created
March 6, 2015 18:52
-
-
Save agragregra/5d3024e684a41652d3c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ============================================================================ | |
// Gallery filters moving on hover underline | |
// ============================================================================ | |
function init_gallery_filters_underline() | |
{ | |
$('.gallety-filters >li:not(.gf-underline)').hover(function(){ | |
go_to_item($(this)); | |
},function(){ | |
go_to_item($(this).siblings('.active')); | |
}); | |
function go_to_item($item) | |
{ | |
if($item.length == 0) return; | |
var parent_left = $item.parent().length ? $item.parent().offset().left : 0; | |
var offset = $item.offset().left - parent_left; | |
$item.siblings('.gf-underline').css({left: offset, width: $item.width()}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment