Changeset 31720
- Timestamp:
- 03/11/2015 04:28:21 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/common.js
r31674 r31720 713 713 window.wpResponsive = { 714 714 init: function() { 715 var self = this; 715 var self = this, 716 x, y; 716 717 717 718 // Modify functionality based on custom activate/deactivate event … … 728 729 event.preventDefault(); 729 730 $wpwrap.toggleClass( 'wp-responsive-open' ); 730 if ( $wpwrap.hasClass( 'wp-responsive-open') ) {731 if ( self.isOpen() ) { 731 732 $(this).find('a').attr( 'aria-expanded', 'true' ); 732 733 $( '#adminmenu a:first' ).focus(); … … 736 737 } ); 737 738 739 $window.on( 'touchstart.wp-responsive', function( event ) { 740 var touches = event.originalEvent.touches; 741 742 if ( 1 !== touches.length ) { 743 return; 744 } 745 746 x = touches[0].clientX; 747 y = touches[0].clientY; 748 } ); 749 750 $window.on( 'touchend.wp-responsive', function( event ) { 751 var touches = event.originalEvent.changedTouches, 752 isOpen = self.isOpen(), 753 distanceX; 754 755 if ( 1 === touches.length && x && y ) { 756 if ( ( window.isRtl && isOpen ) || ( ! window.isRtl && ! isOpen ) ) { 757 distanceX = touches[0].clientX - x; 758 } else { 759 distanceX = x - touches[0].clientX; 760 } 761 762 if ( distanceX > 30 && distanceX > Math.abs( touches[0].clientY - y ) ) { 763 $( '#wp-admin-bar-menu-toggle' ).trigger( 'click' ); 764 } 765 } 766 767 x = y = 0; 768 } ); 769 738 770 // Add menu events 739 771 $adminmenu.on( 'click.wp-responsive', 'li.wp-has-submenu > a', function( event ) { … … 757 789 } 758 790 }); 791 }, 792 793 isOpen: function() { 794 return $wpwrap.hasClass( 'wp-responsive-open' ); 759 795 }, 760 796
Note: See TracChangeset
for help on using the changeset viewer.