mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-05-04 09:54:00 -04:00
add lightbox extra-zoom on click
This commit is contained in:
parent
bfd2fd8607
commit
3842097698
2 changed files with 33 additions and 4 deletions
app/assets
|
@ -8,14 +8,32 @@
|
||||||
Discourse.Lightbox = {
|
Discourse.Lightbox = {
|
||||||
apply: function($elem) {
|
apply: function($elem) {
|
||||||
$LAB.script("/javascripts/jquery.magnific-popup-min.js").wait(function() {
|
$LAB.script("/javascripts/jquery.magnific-popup-min.js").wait(function() {
|
||||||
$('a.lightbox', $elem).each(function(i, e) {
|
$("a.lightbox", $elem).each(function(i, e) {
|
||||||
$(e).magnificPopup({
|
$(e).magnificPopup({
|
||||||
type: 'image',
|
type: "image",
|
||||||
closeOnContentClick: true,
|
closeOnContentClick: false,
|
||||||
|
|
||||||
|
callbacks: {
|
||||||
|
open: function() {
|
||||||
|
var self = this,
|
||||||
|
wrap = this.wrap,
|
||||||
|
img = this.currItem.img,
|
||||||
|
maxHeight = img.css("max-height");
|
||||||
|
|
||||||
|
wrap.on("click.pinhandler", "img", function() {
|
||||||
|
wrap.toggleClass("mfp-force-scrollbars");
|
||||||
|
img.css("max-height", wrap.hasClass("mfp-force-scrollbars") ? "none" : maxHeight);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
beforeClose: function() {
|
||||||
|
this.wrap.off("click.pinhandler");
|
||||||
|
this.wrap.removeClass("mfp-force-scrollbars");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
image: {
|
image: {
|
||||||
titleSrc: function(item) {
|
titleSrc: function(item) {
|
||||||
return item.el.attr('title') + ' · <a class="image-source-link" href="' + item.src + '" target="_blank">' + I18n.t("lightbox.download") + '</a>';
|
return item.el.attr("title") + ' · <a class="image-source-link" href="' + item.src + '" target="_blank">' + I18n.t("lightbox.download") + '</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -639,3 +639,14 @@ button {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.mfp-force-scrollbars {
|
||||||
|
&.mfp-wrap {
|
||||||
|
overflow-y: auto !important;
|
||||||
|
overflow-x: auto !important;
|
||||||
|
}
|
||||||
|
.mfp-img {
|
||||||
|
max-width: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue