You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.
Is there any way to remove onScreen from a specific element?
For example, my page is divided into sections and they all have the same class 'log_entered_viewport'. What I want is that only the first time they enter the viewport that onScreen will be triggered and I will log the event. If the users scrolls up and down the page and the particular section enters the viewport, then I only want it to be triggered once.
The text was updated successfully, but these errors were encountered:
That was quick :) Solved it by adding a 'logged' class to the element and then checking for the class.
In other words, it's like the 'toggleClass' option, except that the class is removed.
doIn: function() {
$e = $(this);
if ( !$e.hasClass('logged') ){
// -- code to log that the element has entered the viewport
// add the class the mark that the element has been logged
$e.addClass('logged');
}
}
Is there any way to remove onScreen from a specific element?
For example, my page is divided into sections and they all have the same class 'log_entered_viewport'. What I want is that only the first time they enter the viewport that onScreen will be triggered and I will log the event. If the users scrolls up and down the page and the particular section enters the viewport, then I only want it to be triggered once.
The text was updated successfully, but these errors were encountered: