inview.php 882 B

123456789101112131415161718192021222324252627282930313233343536
  1. <script src="https://lib.amic.ru/js/waypoints/jquery.waypoints.min.js" defer></script>
  2. <script src="https://lib.amic.ru/js/waypoints/shortcuts/inview.min.js" defer></script>
  3. <ul class="notifications"></ul>
  4. <div class="notifi"></div>
  5. <script>
  6. jQuery(function($){
  7. $notifications = $('.notifications');
  8. $.each( $('.InviewElement'), function (){
  9. new Waypoint.Inview({
  10. element: this,
  11. enter: function(direction) {
  12. notify($(this.element).text())
  13. }
  14. })
  15. })
  16. })
  17. function notify(text) {
  18. var $notification = $('<li />').text(text).css({
  19. left: 320, color: '#eeeeee'
  20. })
  21. $notifications.append($notification)
  22. $notification.animate({
  23. left: 0
  24. }, 300, function() {
  25. $(this).delay(3000).animate({
  26. left: 320
  27. }, 200, function() {
  28. $(this).slideUp(300, function() {
  29. $(this).remove()
  30. })
  31. })
  32. })
  33. }
  34. </script>