esc dismisses lightbox (bug 632558)
This commit is contained in:
Родитель
58c2c9c719
Коммит
791147fae1
|
@ -35,7 +35,7 @@
|
|||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin: -300px 0 0 -350px;
|
||||
margin: -315px 0 0 -365px;
|
||||
width: 700px;
|
||||
height: 600px;
|
||||
}
|
||||
|
|
|
@ -15,11 +15,24 @@ $(function () {
|
|||
function showLightbox() {
|
||||
$lightbox.show();
|
||||
showImage(this);
|
||||
$(window).bind('keydown.lightboxDismiss', function(e) {
|
||||
if (e.which == 27) {
|
||||
hideLightbox();
|
||||
}
|
||||
});
|
||||
//I want to ensure the lightbox is painted before fading it in.
|
||||
setTimeout(function () {
|
||||
$lightbox.addClass("show");
|
||||
},0);
|
||||
}
|
||||
function hideLightbox() {
|
||||
$lightbox.removeClass("show");
|
||||
// We can't trust transitionend to fire in all cases.
|
||||
setTimeout(function() {
|
||||
$lightbox.hide();
|
||||
}, 500);
|
||||
$(window).unbind('keydown.lightboxDismiss');
|
||||
}
|
||||
function showImage(a) {
|
||||
var $a = $(a),
|
||||
$oldimg = $lightbox.find("img");
|
||||
|
@ -73,14 +86,11 @@ $(function () {
|
|||
}
|
||||
}));
|
||||
$(".previews ul a").click(_pd(showLightbox));
|
||||
$("#lightbox .close, #lightbox .content").click(_pd(function() {
|
||||
$lightbox.removeClass("show");
|
||||
// We can't trust transitionend to fire in all cases.
|
||||
setTimeout(function() {
|
||||
$lightbox.hide();
|
||||
}, 500);
|
||||
$('#lightbox').click(_pd(function(e) {
|
||||
if ($(e.target).is('.close, #lightbox')) {
|
||||
hideLightbox();
|
||||
}
|
||||
}));
|
||||
$document.scroll();
|
||||
})();
|
||||
|
||||
if ($('#review-add-box').exists())
|
||||
|
|
Загрузка…
Ссылка в новой задаче