Download the PHP package gaomingcode/is-in-viewport without Composer

On this page you can find all versions of the php package gaomingcode/is-in-viewport. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package is-in-viewport

isInViewport.js

GitHub Version Packagist Downloads Github License

Installation

Composer

ReadMe from Origin

Build Status CDNJS

An ultra-light jQuery plugin that tells you if the element is in the viewport, but with a twist.

Did you say demo (inclusive of tests)?

For a more performant alternative, please take a look at observe-element-in-viewport which uses the new IntersectionObserver API. Please keep in mind that you might have to ship a polyfill for IntersectionObserver depending on the browsers you support.

Note: If you need this in a React application, please use the use-is-in-viewport hook.

Installation

Using in a module

You can then require('is-in-viewport') or import 'is-in-viewport' in your code. It will automagically work with the bundler of your choice. If it breaks, please feel free to open an issue.

Example usage in an ES6/ES2015 module is shown in the examples/es6-example folder.

Note: isInViewport is a side-effecting module. It imports jquery that you have installed and attaches itself on it. As a consequence, isInViewport requires jquery to be installed as a peer dependency. Your bundling will fail if jquery isn't installed as is-in-viewport imports jquery.

Using directly in a script tag

Usage

Basic usage

When used as a selector it returns all the elements that match. Since it returns the element(s) it can thus be chained with other jQuery methods. It can also be used with jquery's .is.

Example:

Both of the above will set the background-color as red for all divs that are in the viewport.

Advanced usage

Using in-viewport pseudo-selector

This returns all the elements that are in the viewport while taking into account the tolerance criterion.

Since it returns the element(s) it can thus be chained with other jQuery methods.

When a viewport selector is specified, it uses that to calculate if the element is in that viewport or not.

When a viewport selector is not specified, it defaults to window as the viewport.

The viewport selector is any valid jQuery selector.

Defaults:
  • tolerance defaults to 0
  • viewport defaults to window
Example:

Example 1 will set the background-color as red for all divs that are in the viewport with a tolerance of 100px.

Example 2 will set the background-color as green for all divs that are in the viewport with a tolerance of viewport height - 100px. This lets the user conveniently provide a tolerance value closer to the viewport height without having to call $(viewport).height() all the time.

Example 3 will set the background-color as blue and text as in viewport for all divs that are in the custom viewport given by #viewport and with a tolerance of 100px.

With the advanced usage it becomes very easy to build things like menus with items that get auto-highlighted based on which section you are on, transition effects when an element comes into the viewport, etc.

See the examples in the examples directory for more clarity.

Note:
  • When tolerance is 0 or undefined it is actually equal to tolerance: $(viewport).height() and not 0.

This makes it easier for developers to have the whole viewport available to them as a valid viewport.

Using exposed isInViewport function

This returns all the elements that are in the viewport while taking into account the tolerance criterion.

Since it returns the element(s) it can thus be chained with other jQuery methods.

When a viewport is specified, it uses that to calculate if the element is in that viewport or not.

When a viewport is not specified, it defaults to window as the viewport.

The viewport is a valid DOM element or jQuery wrapped DOM element, NOT a selector string.

Defaults:
  • tolerance defaults to 0
  • viewport defaults to window
Example:

Support

Chrome, Firefox 3.5+, IE9+, Safari 5+, Opera 10.5+

Note

  • :in-viewport selector does support chaining.

Changelog

3.0.3

  • Use jQuery.expr.pseudos when found since jQuery.expr[':'] is deprecated

3.0.2

  • Support new rollup properties and get rid of removed rollups properties (moduleId, moduleName, etc)

3.0.1

  • Fix jQuery no conflict mode issue (#39)

3.0.0

  • Remove the deprecated $(el).do method
  • Remove support for browsers < { IE9, Safari 5, Opera 10.5, Firefox 3.5 }
  • Add support for modules and bundlers. You can now import 'is-in-viewport'/require('is-in-viewport') in your project (yay!)
  • Add properly functioning sourcemaps for easier debugging

2.4.2

  • Remove postInstall script which was breaking builds

2.4.1

  • Undo 2.4.0 as is-in-viewport already exists on bower and isn't owned by me

2.4.0

  • Update bower.json to comply with new validations
  • Rename package on bower to match with that on npm i.e., is-in-viewport

2.3.1

  • Remove unnecessary boolean coercion

2.3.0

  • Re-exposed isInViewport with saner semantics. You can now pass options as JS objects to isInViewport and hence can now do things like:

  • Deprecated do in favour of run
  • When available, isInViewport now uses Sizzle.selectors.createPseudo

2.2.5

  • Updated readme to point to new demo. Mostly a bump for npm to pickup the new readme.

2.2.4

2.2.3

2.2.2

2.2.1

2.2.0

2.1.0

2.0.0

1.1.1

1.1.0


All versions of is-in-viewport with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package gaomingcode/is-in-viewport contains the following files

Loading the files please wait ....