Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/schmidt/jquery.onscreen
jQuery plugin which adds an :onscreen pseudo selector
https://github.com/schmidt/jquery.onscreen
Last synced: 30 days ago
JSON representation
jQuery plugin which adds an :onscreen pseudo selector
- Host: GitHub
- URL: https://github.com/schmidt/jquery.onscreen
- Owner: schmidt
- License: mit
- Created: 2014-12-08T13:35:45.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2014-12-08T13:58:27.000Z (almost 10 years ago)
- Last Synced: 2023-04-10T07:46:17.537Z (over 1 year ago)
- Language: JavaScript
- Size: 129 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
jQuery.onscreen Plugin
======================This plugin adds a `:onscreen` pseudo selector to the list of jQuery selectors.
You may use it to test, if an partially visible on the screen.Examples
--------Focus the first visible input element:
$("input:onscreen").first().focus()
Scroll element into view if it was not visible before
e = $("#calltoaction")
if (!e.is(":onscreen")) {
e.get(0).scrollIntoView();
}Future work
-----------* Add tests
* Add `:fullyonscreen` which would match if the whole element is on the screen,
not just parts of it.Copyright
---------This code is just a wrapped version of a StackOverflow answer published on
jsfiddle.Here are the relevant sources:
- Author:
- pebbl http://pebbl.co.uk/
- StackOverflow:
- http://stackoverflow.com/q/487073/817202#comment41045330_21627295
- JSFiddle:
- http://jsfiddle.net/9nuqpgqa/