简体   繁体   中英

jQuery.appear plugin is not working

Please look at the following jsfiddle. It is a simple attempt at getting the jQuery.appear plugin to work. What am I doing wrong?

http://jsfiddle.net/P7v8v/1/

The html is:

<div class = 'bar'>foo</div>

Here is the relevant code:

alert('foo bar');
$('.bar').appear();
$('.bar').on('appear', AlertMe);

function AlertMe() {
    alert("alert me");
}

The plugin can be downloaded at https://github.com/morr/jquery.appear#jqueryappear

1) Appear triggers the event on scroll or resize (referencing your javascript fiddle on line 79)

$(window).scroll(on_check).resize(on_check);

2) for the code to work properly enclose it like this:

$(function(){
  ... your code goes here
 });

so it doesn't get executed before the libraries are loaded.

Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM