Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
masonry
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
masonry
Merge requests
!2
Issue
#3343994
: Drupal 10 compatiility?
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Issue
#3343994
: Drupal 10 compatiility?
issue/masonry-3343994:8.x-1.x
into
8.x-1.x
Overview
4
Commits
3
Pipelines
0
Changes
3
3 unresolved threads
Hide all comments
Open
Ann Mary Sruthy
requested to merge
issue/masonry-3343994:8.x-1.x
into
8.x-1.x
2 years ago
Overview
4
Commits
3
Pipelines
0
Changes
3
3 unresolved threads
Hide all comments
Expand
0
0
Merge request reports
Compare
8.x-1.x
version 6
93abcaf2
1 year ago
version 5
1421b471
1 year ago
version 4
23c8e89a
2 years ago
version 3
0c3b9645
2 years ago
version 2
4f917d03
2 years ago
version 1
1421b471
2 years ago
8.x-1.x (HEAD)
and
version 1
latest version
e0537e94
3 commits,
1 year ago
version 6
93abcaf2
2 commits,
1 year ago
version 5
1421b471
1 commit,
1 year ago
version 4
23c8e89a
5 commits,
2 years ago
version 3
0c3b9645
3 commits,
2 years ago
version 2
4f917d03
2 commits,
2 years ago
version 1
1421b471
1 commit,
2 years ago
3 files
+
18
−
13
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
js/masonry.js
+
17
−
11
Options
@@ -15,17 +15,20 @@
* (internal) Sub-function for code factoring: actually build masonry.
*/
function
_buildMasonry
(
$container
,
options
)
{
// Check if masonry already exists
let
masonryExists
=
$container
.
hasClass
(
'
masonry
'
);
// If no masonry find in container: init it...
if
(
$container
.
findOnce
(
'
masonry
'
).
length
===
0
)
{
$container
.
once
(
'
masonry
'
).
addClass
(
'
masonry
'
).
masonry
(
options
);
if
(
!
masonryExists
)
{
$container
.
addClass
(
'
masonry
'
).
masonry
(
options
);
$
(
window
).
resize
(
function
()
{
$container
.
findOnce
(
'
masonry
'
).
masonry
(
'
bindResize
'
);
$container
.
masonry
(
'
bindResize
'
);
});
}
else
{
// ...otherwise, simply rebuild the layout.
$container
.
masonry
(
'
reloadItems
'
).
masonry
(
'
layout
'
);
}
// Hack to support lazysizes lazy loading.
if
(
options
.
imagesLazyLoad
)
{
let
lastClassState
=
false
;
@@ -33,13 +36,13 @@
mutationsList
.
forEach
(
function
(
mutation
)
{
if
(
mutation
.
type
===
'
attributes
'
&&
mutation
.
attributeName
===
'
class
'
)
{
let
currentClassState
=
mutation
.
target
.
classList
.
contains
(
options
.
lazyloadedSelector
);
if
(
lastClassState
!==
currentClassState
)
{
lastClassState
=
currentClassState
;
if
(
currentClassState
)
{
if
(
options
.
imagesFirst
)
{
$container
.
imagesLoaded
(
function
()
{
imagesLoaded
(
$container
[
0
],
function
()
{
$container
.
masonry
(
'
reloadItems
'
).
masonry
(
'
layout
'
);
});
}
else
{
@@ -50,12 +53,15 @@
}
});
});
$
(
'
img.
'
+
options
.
lazyloadSelector
,
$container
).
once
(
'
imgloaded
'
).
each
(
function
()
{
observer
.
observe
(
this
,
{
attributes
:
true
});
$
(
'
img.
'
+
options
.
lazyloadSelector
,
$container
).
each
(
function
()
{
if
(
!
$
(
this
).
hasClass
(
'
imgloaded
'
))
{
$
(
this
).
addClass
(
'
imgloaded
'
);
observer
.
observe
(
this
,
{
attributes
:
true
});
}
});
}
}
}
/**
* Apply Masonry.
Loading