Skip to content

foobarbaz-pl/jquery.is-scrollable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jQuery Is Scrollable Plugin

This jQuery plugin will help you with finding HTML elements with a scrollbar. Horizontally and vertically scrollable elements are found by actually trying to scroll them using jQuery.scrollLeft and jQuery.scrollTop methods.

Solutions using only a comparison of scrollHeight, clientHeight or scrollWidth, clientWidth attributes can be found on the internet, however they fail in many cases.

Requirements

  • jQuery (>=1.2.6)

Install

You can install plugin via npm

npm install --save jquery.is-scrollable

or you can download the latest release from GitHub and copy files from dist folder into your project.

Usage

  1. Include jQuery:
<script src="jquery-2.2.4.min.js" type="text/javascript"></script>
```
  1. Include plugin's code:
<script src="jquey.is-scrollable.min.js" type="text/javascript"></script>
```
  1. Call the plugin:

// returns all div elements with horizontal scrollbar $('div:horizontally-scrollable')

// returns all div elements with vertical scrollbar $('div:visible:vertically-scrollable')

// returns true if element has horizontal scrollbar $('#hv-scroll').isHorizontallyScrollable()

// returns true if element has vertical scrollbar $('#hv-scroll').isVerticallyScrollable() ```

License

MIT License © Sebastian Cichosz

About

A jQuery plugin to check if element has a scrollbar.

Resources

License

Stars

Watchers

Forks

Packages

No packages published