Detects if an element (tooltip) falls of the right/left side of your screen/viewport
Adds a class to all your elements with the defined selector that fall of the right/left side of the screen.
- checks all the elements with the defined selector.
- rechecks everything when resize (optimized resize)
- smartresize to increase performance
- customize classes
$( document ).ready(function() {
$('.tooltip__content').offscreen({
smartResize: true,
rightClass: 'right-edge',
leftClass: 'left-edge'
});
});
jQuery