Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 511
Barka Avatar asked Nov 11 '22 17:11

Barka


1 Answers

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

like image 183
Charlie Affumigato Avatar answered Nov 15 '22 02:11

Charlie Affumigato