The viewport is the visible section of a page, shown to a visitor.
Sonar can be used in various ways:
- to detect if an element is visible (full or in part) in the viewport
- its position compared to viewport adges
- trigger actions when an element enters the viewport (for lazy loading actions)
Requirements:
· JavaScript enabled on client side
· jQuery
What's New in This Release: [ read full changelog ]
· Fixed a bug in the polling code where splicing caused our for loop to skip over the next iteration in the loop. This caused some images in the poll to be detected when they should have been.
· Re-factored Sonar to use the "Module" JavaScript library pattern, making our private variables and functions more private and inaccessible from the public interface.
· Updated the sonar.add() function to return true or false, useful for determining if Sonar added the elem to the poll or executed its callback immediately.