Changeset 31910
- Timestamp:
- 03/27/2015 05:47:55 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/common.js
r31908 r31910 706 706 window.wpResponsive = { 707 707 init: function() { 708 var self = this, 709 x, y; 708 var self = this; 710 709 711 710 // Modify functionality based on custom activate/deactivate event … … 722 721 event.preventDefault(); 723 722 $wpwrap.toggleClass( 'wp-responsive-open' ); 724 if ( self.isOpen() ) {723 if ( $wpwrap.hasClass( 'wp-responsive-open' ) ) { 725 724 $(this).find('a').attr( 'aria-expanded', 'true' ); 726 725 $( '#adminmenu a:first' ).focus(); … … 730 729 } ); 731 730 732 $window.on( 'touchstart.wp-responsive', function( event ) {733 var touches = event.originalEvent.touches;734 735 if ( 1 !== touches.length ) {736 return;737 }738 739 x = touches[0].clientX;740 y = touches[0].clientY;741 } );742 743 $window.on( 'touchend.wp-responsive', function( event ) {744 var touches = event.originalEvent.changedTouches,745 isOpen = self.isOpen(),746 distanceX;747 748 if ( 1 === touches.length && x && y ) {749 if ( ( window.isRtl && isOpen ) || ( ! window.isRtl && ! isOpen ) ) {750 distanceX = touches[0].clientX - x;751 } else {752 distanceX = x - touches[0].clientX;753 }754 755 if ( distanceX > 30 && distanceX > Math.abs( touches[0].clientY - y ) ) {756 $( '#wp-admin-bar-menu-toggle' ).trigger( 'click' );757 }758 }759 760 x = y = 0;761 } );762 763 731 // Add menu events 764 732 $adminmenu.on( 'click.wp-responsive', 'li.wp-has-submenu > a', function( event ) { … … 782 750 } 783 751 }); 784 },785 786 isOpen: function() {787 return $wpwrap.hasClass( 'wp-responsive-open' );788 752 }, 789 753
Note: See TracChangeset
for help on using the changeset viewer.