SkillAgentSearch skills...

Offscreen.js

Detects if an element falls of the viewport of your screen

Install / Use

/learn @gijsroge/Offscreen.js
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

offscreen.js

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

demo

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',
    widthOffset: 40, //px value
    smartResize: true
  });
});   

Requires:

jQuery

@GijsRoge

View on GitHub
GitHub Stars106
CategoryDevelopment
Updated3y ago
Forks11

Languages

JavaScript

Security Score

80/100

Audited on Oct 11, 2022

No findings