Advertisement
srikat

Untitled

Mar 3rd, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. if (sp(window).width() < 800) {
  2. sp( '.js-superfish' ).superfish( 'destroy' );
  3. }
  4.  
  5. sp(window).resize(function() {
  6. if (sp(this).width() < 800) {
  7. sp( '.js-superfish' ).superfish( 'destroy' );
  8. sp( '.menu-item-has-children' ).removeClass( 'menu-open' );
  9. } else {
  10. sp('nav').removeAttr('style');
  11. sp( '.js-superfish').superfish({
  12. 'delay': 100,
  13. 'animation': {'opacity': 'show', 'height': 'show'},
  14. 'dropShadows': false
  15. });
  16. }
  17. });
  18.  
  19. var mb_btn = '<button class="mobile-menu" id="mobile-menu" aria-pressed="false" aria-expanded="false" role="button">' +
  20. 'Menu <span class="icon ion-drag close"></span>' +
  21. '</button>';
  22.  
  23. sp('.nav-header,.nav-secondary').before( mb_btn );
  24.  
  25. sp( '.mobile-menu' ).click(function( event ) {
  26.  
  27. if( sp(this).find('.icon').hasClass('close') ) {
  28. sp(this).find('.icon').removeClass('close ion-drag').addClass('open ion-android-close');
  29. }else{
  30. sp(this).find('.icon').removeClass('open ion-android-close').addClass('ion-drag close');
  31. }
  32.  
  33. if( sp(this).next().is('.site-navigation') ) {
  34. sp(this).next('.site-navigation').find('nav').slideToggle();
  35. } else {
  36. sp(this).next('.nav-header,.nav-secondary').slideToggle();
  37. }
  38.  
  39. });
  40.  
  41. sp( '.menu .menu-item' ).click(function(event){
  42. patt = new RegExp( '#' );
  43. if ( ( event.target !== this ) && ( ! patt.test(event.target) ) )
  44. return;
  45.  
  46. sp(this).find( '.sub-menu:first' ).slideToggle(function() {
  47. sp(this).parent().toggleClass( 'menu-open' );
  48. });
  49. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement