UNPKG

jquery.pep.js

Version:

Kinetic drag for mobile & desktop

59 lines (45 loc) 1.35 kB
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>jquery.pep unbind demo</title> <!-- Load local jQuery. --> <script src="../libs/jquery/jquery.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> <!-- Load local lib and tests. --> <script src="../src/jquery.pep.js"></script> <script type="text/javascript"> $(document).ready(function(){ var $pep = $('.pep'); $pep.pep(); $('.toggle-bind').click(function(){ var $this = $(this); var newtext = ''; var val = 0; if ( $this.data('bound') == 1 ){ newtext = 'Bind'; val = 0; $.pep.unbind( $pep ); } else { newtext = 'Unbind'; val = 1; $pep.pep({ hardwareAccelerate: false }); } $this.text(newtext) .data('bound', val); }) }); </script> <style type="text/css"> .pep{ width: 200px; height: 200px; } .pep1{ background: blue; } .pep2{ background: red; } </style> </head> <body> <button class='toggle-bind' data-bound=1>Unbind</button> <div class="pep pep1"></div> <div class="pep pep2"></div> </body> </html>