Skip to content

Instantly share code, notes, and snippets.

@Arduinology
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Arduinology/75f9a47b775fb8cd759e to your computer and use it in GitHub Desktop.
Save Arduinology/75f9a47b775fb8cd759e to your computer and use it in GitHub Desktop.
// change main category hover image
$('.maincategories .maincategory .views-row').each(function() {
$(this).mouseover(function() {
var tip = $(this).find('.views-field-name a').text();
$(this).attr('title', tip);
$(this).find('.views-field-field-hover-image').show();
$(this).find('.views-field-field-default-image').hide();
});
$(this).mouseout(function() {
$(this).find('.views-field-field-hover-image').hide();
$(this).find('.views-field-field-default-image').show();
});
});
active = jQuery('.views-field-field-hover-image a.active');
imgValue = jQuery(active).parent().parent().siblings('.views-field-field-default-image').find('img').attr("src");
newImgValue = newImgValue.replace(/(_0)/g, "-hover$1");
jQuery(active).parent().parent().siblings('.views-field-field-default-image').find('img').attr("src", newImgValue);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment