Giter Club home page Giter Club logo

jquery-appear's Introduction

jQuery-appear

A jQuery plugin provides appear and disappear events to do lazyload, infinite scroll or else effect.

Download

Compress
Uncompress

Installation

You can also install jquery-appear by using Bower.

bower install jquery-appear

Demo

Lazyload (Overflow and Tabs) (You could also refer to jQuery-lazyload-any)
Infinite Scroll

Browser Support

jQuery-appear currently supports IE7+, Chrome, Firefox, Safari and Opera.

Usage

You could just use jQuery bind, delegate or on to listen event. HTML

<div id="#you-want-to-detect">
</div>

JavaScript

$('#you-want-to-detect').bind('appear', appearHandler);
$('#you-want-to-detect').bind('disappear', disappearHandler);

Methods

$.appear.check()

Force to trigger detection event.

$.appear.setInterval(inverval)

Set interval of timer that check container display status.

inverval: Number (default: 50)

Interval of timer. Set 0 to disable timer, and you can use $.appear.check() to trigger detection manually.

$.appear.refresh(selector)

Refresh status of elements bound event. Element will bind scroll event to parent scrollable automatically when binding appear event. If you move element, you should use this method to bind again.

selector: String or Object (default: undefined)

The elements that you want to refresh. It will refresh all elements bound appear event if you don't pass this parameter.

Notice

  • You should initialize after the element add to page. Or it can't detect whether it's in screen. If you do that, you still can use $.appear.check() to force detection.
  • Detection uses jQuery element.is(':visible'), it will return false if element's width and height are equal to zero. So you have to make sure the appear element with any width or height.

Example

HTML

<div id="loading">
  <img src="loading.gif" />
</div>

JavaScript

$('#loading').bind('appear', ajaxLoad);

License

The project is released under the MIT license.

Contact

The project's website is located at https://github.com/emn178/jquery-appear
Author: [email protected]

jquery-appear's People

Contributors

emn178 avatar

Watchers

Carabineiro avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.