carabina / offscreen.js

Detects if an element falls of the viewport of your screen

Home Page:http://gijsroge.github.io/offscreen.js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

offscreen.js

Detects if an element (tooltip) falls of the right/left/top/bottom side of your screen/viewport

What does it do?

Adds a class to all your elements with the defined selector that fall of the right/left/top/bottom side of the screen.

  • checks all the elements with the defined selector.
  • rechecks everything when resize (optimized resize)
  • customize classes

Usage:

$( document ).ready(function() {
  $('.tooltip__content').offscreen({
    rightClass: 'right-edge',
    leftClass: 'left-edge',
    topClass: 'top-edge',
    bottomClass: 'bottom-edge',
    smartResize: true
  });
});   

Requires:

jQuery

@GijsRoge

About

Detects if an element falls of the viewport of your screen

http://gijsroge.github.io/offscreen.js/

License:MIT License


Languages

Language:JavaScript 100.0%