Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
views_infinite_scroll-3373647
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Issue forks
views_infinite_scroll-3373647
Commits
c95631dc
Commit
c95631dc
authored
8 years ago
by
Alexandr Davyskiba
Committed by
Sam Becker
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2649470
by zviryatko, Sam152: Not working with ajax exposed form in block
parent
745f4991
No related branches found
Branches containing commit
Tags
7.81
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
js/infinite-scroll.js
+19
-3
19 additions, 3 deletions
js/infinite-scroll.js
with
19 additions
and
3 deletions
js/infinite-scroll.js
+
19
−
3
View file @
c95631dc
(
function
(
$
)
{
"
use strict
"
;
// Cached reference to $(window).
var
$window
=
$
(
window
);
// The threshold for how far to the bottom you should reach before reloading.
var
scroll_threshold
=
200
;
// The selector for the automatic pager.
var
automatic_pager_selector
=
'
.infinite-scroll-automatic-pager
'
;
// The event and namespace that is bound to window for automatic scrolling.
var
scroll_event
=
'
scroll.views_infinite_scroll
'
;
/**
* Insert a views infinite scroll view into the document.
*/
...
...
@@ -22,16 +29,25 @@
*/
Drupal
.
behaviors
.
views_infinite_scroll_automatic
=
{
attach
:
function
(
context
,
settings
)
{
$
(
'
.infinite-scroll-
automatic
-
pager
'
,
context
).
once
().
each
(
function
()
{
$
(
automatic
_
pager
_selector
,
context
).
once
().
each
(
function
()
{
var
$pager
=
$
(
this
);
$pager
.
addClass
(
'
visually-hidden
'
);
$window
.
on
(
'
scroll
.views_infinite_scroll
'
,
function
()
{
$window
.
on
(
scroll
_event
,
function
()
{
if
(
window
.
innerHeight
+
window
.
pageYOffset
>
$pager
.
offset
().
top
-
scroll_threshold
)
{
$pager
.
find
(
'
[rel=next]
'
).
click
();
$window
.
off
(
'
scroll
.views_infinite_scroll
'
);
$window
.
off
(
scroll
_event
);
}
});
});
},
detach
:
function
(
context
,
settings
,
trigger
)
{
// In the case where the view is removed from the document, remove it's
// events. This is important in the case a view being refreshed for a reason
// other than a scroll. AJAX filters are a good example of the event needing
// to be destroyed earlier than above.
if
(
$
(
automatic_pager_selector
,
context
).
length
!=
0
)
{
$window
.
off
(
scroll_event
);
}
}
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment