unbind.html 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>jquery.pep unbind demo</title>
  6. <!-- Load local jQuery. -->
  7. <script src="../libs/jquery/jquery.js"></script>
  8. <script src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
  9. <!-- Load local lib and tests. -->
  10. <script src="../src/jquery.pep.js"></script>
  11. <script type="text/javascript">
  12. $(document).ready(function(){
  13. var $pep = $('.pep');
  14. $pep.pep();
  15. $('.toggle-bind').click(function(){
  16. var $this = $(this);
  17. var newtext = '';
  18. var val = 0;
  19. if ( $this.data('bound') == 1 ){
  20. newtext = 'Bind';
  21. val = 0;
  22. $.pep.unbind( $pep );
  23. }
  24. else {
  25. newtext = 'Unbind';
  26. val = 1;
  27. $pep.pep({ hardwareAccelerate: false });
  28. }
  29. $this.text(newtext)
  30. .data('bound', val);
  31. })
  32. });
  33. </script>
  34. <style type="text/css">
  35. .pep{ width: 200px; height: 200px; background: blue; }
  36. </style>
  37. </head>
  38. <body>
  39. <button class='toggle-bind' data-bound=1>Unbind</button>
  40. <div class="pep"></div>
  41. </body>
  42. </html>