Difference between revisions of "Template:Cologne-Duesseldorf/js-jquery"

Line 1: Line 1:
 
<html>
 
<html>
 
<body>
 
<body>
 +
<!--- Scripts ---->
 +
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
 +
    <script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
 
 
 
<!-- jQuery -->
 
<!-- jQuery -->
Line 20: Line 23:
 
$('#sidebar ul ul.sub').click(function(){
 
$('#sidebar ul ul.sub').click(function(){
 
$(this).children().toggleClass('active');
 
$(this).children().toggleClass('active');
});
+
});
$(function(){
+
  $( "#container" ).on( "swiperight", swipeHandler );
+
  $( "#overlay" ).on( "swipeleft", swipeHandler );
+
  function swipeHandler( event ){
+
$('#sidebar').toggleClass('visible');
+
$('#overlay').toggleClass('active');
+
$('#container').toggleClass('inactive');
+
$('#sidebar-btn').toggleClass('inactive');
+
  }
+
});
+
 
});
 
});
 +
$(function(){
 +
  $( "#container" ).on( "swiperight", swipeHandler );
 +
  $( "#overlay" ).on( "swipeleft", swipeHandler );
 +
  function swipeHandler( event ){
 +
$('#sidebar').toggleClass('visible');
 +
$('#overlay').toggleClass('active');
 +
$('#container').toggleClass('inactive');
 +
$('#sidebar-btn').toggleClass('inactive');
 +
  }
 +
});
 
 
  

Revision as of 19:49, 5 May 2017