Last active
December 17, 2015 04:08
-
-
Save laurendavissmith/5548190 to your computer and use it in GitHub Desktop.
pulse overlay using e.dom
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
(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