jquery-scrollintoview
When a DIV is scrolled into or out of the visible part of browser it executes a function.
Last updated 5 years ago by kchan .
MIT · Original npm · Tarball · package.json
$ cnpm install jquery-scrollintoview 
SYNC missed versions from official npm registry.

jQuery.scrollIntoView

When a DIV is scrolled into or out of the visible part of browser it executes a function.

demo

Install

bower install jquery-scrollIntoView
npm install jquery-scrollintoview

Usage

$.scrollIntoView(mount, unmount, once)

mount: function, executed when scrolled into the view
unmount: function, executed when scrolled out of the view
once: boolean, default is false, it will still trigger the function when the specific element is already visible in view unless once is set to be true.

$(function () {

  var mount = function () {
    $('body').css('background-color', 'red')
    console.log('hi')
  }
  var unmount = function () {
    $('body').css('background-color', '#fff')
    console.log('out')
  }

  $('.m2').scrollIntoView(mount, unmount, true)

})

License

This project is released under SOX license that means you can do whatever you want to do, but you have to open source your copy on github if you let the public uses it. All copies should be released under the same license. The owner of each copy is only reponsible for his own copy, not for the parents, not for the children.

permitted use:
fork on github
change
do evil with your copy

prohibted use:
do evil with copies not of your own
open source your copy without declaring your parent copy

Current Tags

  • 0.0.10                                ...           latest (5 years ago)

1 Versions

  • 0.0.10                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (6)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |