Line 1: | Line 1: | ||
<html> | <html> | ||
<body> | <body> | ||
− | <!-- | + | <!-- jQuery js --> |
− | + | ||
<script> | <script> | ||
$(document).ready(function(){ | $(document).ready(function(){ | ||
Line 21: | Line 20: | ||
$(this).children().toggleClass('active'); | $(this).children().toggleClass('active'); | ||
}); | }); | ||
− | + | }); | |
− | + | </script> | |
− | + | ||
− | }); | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
+ | <!-- hammer js ---> | ||
+ | <script> | ||
+ | var myContainer = document.getElementById('container'); | ||
+ | var myOverlay = document.getElementById('overlay'); | ||
− | + | // create a simple instance | |
− | + | // by default, it only adds horizontal recognizers | |
− | + | var mC = new Hammer(myContainer); | |
− | </script> | + | var mO = new Hammer(myOverlay); |
+ | |||
+ | // listen to events... | ||
+ | mC.on("panright", function(ev) { | ||
+ | $('#sidebar').addClass('visible'); | ||
+ | $('#overlay').addClass('active'); | ||
+ | $('#container').addClass('inactive'); | ||
+ | $('#sidebar-btn').addClass('inactive'); | ||
+ | }); | ||
+ | |||
+ | mO.on("panleft", function(ev) { | ||
+ | $('#sidebar').removeClass('visible'); | ||
+ | $('#overlay').removeClass('active'); | ||
+ | $('#container').removeClass('inactive'); | ||
+ | $('#sidebar-btn').removeClass('inactive'); | ||
+ | }); | ||
+ | </script> | ||
</body> | </body> | ||
</html> | </html> |
Revision as of 14:47, 6 May 2017