Skip to content
This repository has been archived by the owner on Oct 22, 2018. It is now read-only.

falsandtru/jquery-visibilitytrigger

Repository files navigation

VisibilityTrigger

Document | js | d.ts

Build Status Coverage Status Dependency Status

Run callback to detect an element to have been displayed by the scroll.

Feature

  • Skip
  • Ahead
  • Repeat
  • Standby

Usage

$.visibilitytrigger
.open({
  ns: '.img.primary',
  trigger: '#primary img.delay',
  handler: function () {
    this.src = this.getAttribute('data-origin');
  },
  rush: 3,
  ahead: .1,
  skip: true
})
.open({
  ns: '.img.secondary',
  trigger: '#secondary img.delay',
  handler: function () {
    this.src = this.getAttribute('data-origin');
  },
  rush: 3,
  ahead: .1,
  skip: true
})
.open({
  ns: '.sh.primary',
  trigger: '#primary pre.sh.delay',
  handler: function () {
    SyntaxHighlighter.highlight(SyntaxHighlighter.defaults, this);
  },
  rush: 3,
  ahead: .1,
  skip: true,
  step: 0
})
.disable().enable('img').vtrigger();

// any process

$.vt.enable().vtrigger('primary').vtrigger();

API

Sorry, there are only Japanese documents. I welcome translation.

Browser

Support major browsers.

  • IE6+
  • Chrome
  • Firefox
  • Safari
  • Opera
  • Android
  • iOS

jQuery

  • v1.4.2
  • v1.7.2
  • v1.11.1
  • v2.1.1

License

MIT License