Skip to content

Instantly share code, notes, and snippets.

@jaybuys
Created December 10, 2013 18:20
Show Gist options
  • Save jaybuys/7895346 to your computer and use it in GitHub Desktop.
Save jaybuys/7895346 to your computer and use it in GitHub Desktop.
Simple jQuery function to add rollover functionality to promo boxes. Adds/Removes an "over" class to the main container for CSS styling and has a click function so that the entire promo box will be clickable to the hyperlink housed inside.
$(function() {
// Promo rollovers
$('.promo').mouseover(function() {
$(this).addClass('over');
}).mouseout(function() {
$(this).removeClass('over');
}).click(function() {
location.href = $(this).find('a').attr('href');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment