Skip to content

Commit

Permalink
Lightbox (Featherlight) lokálně + zoom fix (viz noelboss/featherlight…
Browse files Browse the repository at this point in the history
  • Loading branch information
deefha committed Aug 3, 2018
1 parent 2a66d84 commit 59cb319
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 2 deletions.
8 changes: 8 additions & 0 deletions css/jquery.featherlight-1.7.13.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions css/jquery.featherlight.gallery-1.7.13.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

<link rel="stylesheet" href="css/normalize-3.0.2.min.css">
<link rel="stylesheet" href="css/jquery.jsonview.css">
<link rel="stylesheet" href="css/jquery.featherlight-1.7.13.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/themes/default/style.min.css">
<link rel="stylesheet" href="https://cdn.rawgit.com/noelboss/featherlight/1.7.13/release/featherlight.min.css">
<link rel="stylesheet" href="css/index.css">

<script src="js/vendor/modernizr-2.8.3.min.js"></script>
Expand All @@ -36,8 +36,8 @@
<script src="js/vendor/jquery.cookie-2.0.3.js"></script>
<script src="js/vendor/jquery.query-2.2.0.js"></script>
<script src="js/vendor/jquery.jsonview.js"></script>
<script src="js/vendor/jquery.featherlight-1.7.13.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/jstree.min.js"></script>
<script src="https://cdn.rawgit.com/noelboss/featherlight/1.7.13/release/featherlight.min.js"></script>

<script src="js/vendor/klan/klan-3.0.0.js"></script>
<script src="js/vendor/klan/klan.api-3.0.1.js"></script>
Expand Down
22 changes: 22 additions & 0 deletions js/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
(function($) {

$.featherlight.prototype.resize = function(w, h) {
if (w && h) {
/* Reset apparent image size first so container grows */
this.$content.css('width', '').css('height', '');

/* Rescale only if the image does not fit in the window */
if (this.$content.parent().width() < w || this.$content.parent().height() < h) {
/* Calculate the worst ratio so that dimensions fit */
/* Note: -1 to avoid rounding errors */
var ratio = Math.max(
w / (this.$content.parent().width()-1),
h / (this.$content.parent().height()-1)
);
/* Resize content */
if (ratio > 1) {
ratio = h / Math.floor(h / ratio); /* Round ratio down so height calc works */
this.$content.css('width', '' + w / ratio + 'px').css('height', '' + h / ratio + 'px');
}
}
}
};

if ($('#klan-app-viewer').length && !!$.prototype.klan_app_viewer) {
$('#klan-app-viewer').klan_app_viewer();
}
Expand Down
8 changes: 8 additions & 0 deletions js/vendor/jquery.featherlight-1.7.13.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions js/vendor/jquery.featherlight.gallery-1.7.13.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 59cb319

Please # to comment.