Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Chen-Zhe/photo-grid.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Kanyshev <aerohub@users.noreply.github.com>2018-08-02 11:16:51 +0300
committerGitHub <noreply@github.com>2018-08-02 11:16:51 +0300
commit6fd4b20fe0210421a60df7eb587aee78d5dc708c (patch)
treeaa1d423f731c1c61489422268a933df9e4885c35
parent40754870b76aed38ef03c720b9d08a1867c4cdcd (diff)
parent1ce51aff424151bfba325b0f8dbfbb23b9a0949b (diff)
Merge pull request #19 from gcalmettes/master
Allow for multiple `og-grid` elements on the same page
-rw-r--r--layouts/partials/scripts.html6
1 files changed, 3 insertions, 3 deletions
diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html
index 93a33ef..d0d1427 100644
--- a/layouts/partials/scripts.html
+++ b/layouts/partials/scripts.html
@@ -124,7 +124,7 @@
var Grid = (function() {
- var $grid = $( '#og-grid' ),
+ var $grid = $( '*#og-grid' ),
$items = $grid.children( 'li' ),
current = -1,
previewPos = -1,
@@ -213,7 +213,7 @@
} ).children( 'a' ).on( 'click', function(e) {
var $item = $( this ).parent();
- current === $item.index() ? hidePreview() : showPreview( $item );
+ current === Array.from($items).findIndex(d => d == $item[0]) ? hidePreview() : showPreview( $item );
return false;
} );
@@ -260,7 +260,7 @@
function Preview( $item ) {
this.$item = $item;
- this.expandedIdx = this.$item.index();
+ this.expandedIdx = Array.from($items).findIndex(d => d == this.$item[0]);
this.create();
this.update();
}