forked from github/developer.github.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimages.js
More file actions
25 lines (22 loc) · 783 Bytes
/
images.js
File metadata and controls
25 lines (22 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
$(function() {
// copy Help's image show/hide functionality in OLs
var dismissFullImage;
$('ol img').each(function(index, elem) {
return $(elem).parent().prepend(elem);
});
$(document).on('click', 'ol img', function(event) {
var $fullImg, $img;
dismissFullImage();
$img = $(event.currentTarget).clone();
$fullImg = $('<div class="js-full-image full-image"><span class="octicon octicon-remove-close"></span></div>').prepend($img);
$(this).closest('li').append($fullImg);
return $(document).on('click', '.js-full-image', function() {
dismissFullImage();
return false;
});
});
dismissFullImage = function() {
$(document).off('click', '.js-full-image', dismissFullImage);
return $('.js-full-image').remove();
};
});