Skip to content

Instantly share code, notes, and snippets.

@laurendavissmith
Last active December 17, 2015 04:08
Show Gist options
  • Save laurendavissmith/5548190 to your computer and use it in GitHub Desktop.
Save laurendavissmith/5548190 to your computer and use it in GitHub Desktop.
pulse overlay using e.dom
(function() {
var overlay = $('<div class="__overlay__" />').css({
padding: '10px',
opacity: '.5',
background: '#000',
color: '#fff',
textAlign: 'right',
position: 'absolute',
fontSize: '11px'
})
pulse.on('contentmouseover', function(e) {
e.dom.append(
overlay
.empty()
.width( e.dom.find('img').width() - 20 )
.height( e.dom.find('img').height() - 20 )
.css({ left: e.dom.find('img').parent().get(0).style.left, top: e.dom.find('img').parent().get(0).style.top })
.append(e.data.caption || e.data.title || e.data.filename)
.on('mouseout', function() { $(this).remove(); })
);
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment