diff options
author | Pavel Kanyshev <aerohub@users.noreply.github.com> | 2018-08-02 11:16:51 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-02 11:16:51 +0300 |
commit | 6fd4b20fe0210421a60df7eb587aee78d5dc708c (patch) | |
tree | aa1d423f731c1c61489422268a933df9e4885c35 /layouts | |
parent | 40754870b76aed38ef03c720b9d08a1867c4cdcd (diff) | |
parent | 1ce51aff424151bfba325b0f8dbfbb23b9a0949b (diff) |
Allow for multiple `og-grid` elements on the same page
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/partials/scripts.html | 6 |
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(); } |