Skip to content

UnintendedFraud/Disable-When-Hidden

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Disable-When-Hidden

Very fast angular directive to remove the watchers related to elements outside of the viewport. No DOM manipulation.

Note: This directive use the debug information provided by Angular by default, however we can disable it since 1.3 so if you did it (and you probably should have), it won't work.

Usage

We have 2 directives.

The first one to put on the parent element that contains the elements you want to disable, and the 2nd one to put on every element you wish to hide.

I'll copy the basic example to explain better, here is a simple ngRepeat:

<div disable-when-hidden>
  <div ng-repeat="item in list.array" class="item" dwh-element>
    <p ng-bind='item.title'></p>
  </div>
</div>

DisableWhenHiddenregisters a listener to a scroll event on the document, that will broadcast an event to alert every dwhElement to either disable watchers, re-enable them or do nothing.

About

AngularJS directive to remove hidden watchers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors