Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery Waypoints error "notify is not defined"

Yes, I know this probably has nothing to do with waypoints. I'm sorry.

I am following this example: http://imakewebthings.com/jquery-waypoints/#get-started

Here is my very simple javascript:

<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="/includes/js/waypoints/waypoints.min.js"></script>
<script type="text/javascript">
$(document).ready(function(direction) {
$('#example-basic').waypoint(function() {
  notify('Basic example callback triggered.');
});
});
</script>

The scripts are loaded. The jQuery code is pretty much word-for word copied from the example.

And I am getting that error whenever I scroll past element with id 'example-basic'.

I cannot find information on any such "notify" method.

Any ideas?

like image 242
Buttle Butkus Avatar asked Dec 26 '22 22:12

Buttle Butkus


2 Answers

There is a function defined in index.js as Notify, may be that's all you need

var notify = function(message) {
      var $message = $('<p style="display:none;">' + message + '</p>');

      $('.notifications').append($message);
      $message.slideDown(300, function() {
        window.setTimeout(function() {
          $message.slideUp(300, function() {
            $message.remove();
          });
        }, 2000);
      });
    };
like image 164
Michael B. Avatar answered Dec 28 '22 11:12

Michael B.


Notify is a totally separate library from Waypoints (!!), I just realized this myself. You need to have notify included, along w JQuery, it is not a built in function to JQuery or JavaScript:

http://notifyjs.com/

like image 25
Eleanor Zimmermann Avatar answered Dec 28 '22 11:12

Eleanor Zimmermann