Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita2071a4

Browse files
committed
Remove pointer events code completely
1 parentfd51012 commita2071a4

File tree

6 files changed

+15
-73
lines changed

6 files changed

+15
-73
lines changed

‎client/dist/responsive-nav.js‎

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* https://github.com/viljamis/responsive-nav.js
33
* http://responsive-nav.com
44
*
5-
* Copyright (c)2014 @viljamis
5+
* Copyright (c)2015 @viljamis
66
* Available under the MIT license
77
*/
88

@@ -286,9 +286,6 @@
286286
}else{
287287
this.close();
288288
}
289-
290-
// Enable pointer events again
291-
this._enablePointerEvents();
292289
}
293290
},
294291

@@ -536,21 +533,19 @@
536533
},
537534

538535
/**
539-
* On touch start get the location of the touch
540-
* and disable pointer events on the body.
536+
* On touch start we get the location of the touch
541537
*
542538
*@param {event} event
543539
*/
544540
_onTouchStart:function(e){
545541
this._preventDefault(e);
546-
addClass(document.body,"disable-pointer-events");
547542
this.startX=e.touches[0].clientX;
548543
this.startY=e.touches[0].clientY;
549544
this.touchHasMoved=false;
550545

551546
/**
552547
* We remove mouseup event completely here to avoid
553-
* double triggeringof events.
548+
* double triggeringthe event.
554549
*/
555550
removeEvent(navToggle,"mouseup",this,false);
556551
},
@@ -564,7 +559,6 @@
564559
_onTouchMove:function(e){
565560
if(Math.abs(e.touches[0].clientX-this.startX)>10||
566561
Math.abs(e.touches[0].clientY-this.startY)>10){
567-
this._enablePointerEvents();
568562
this.touchHasMoved=true;
569563
}
570564
},
@@ -587,11 +581,6 @@
587581
// If the event type is touch
588582
if(e.type==="touchend"){
589583
this.toggle();
590-
if(opts.insert==="after"){
591-
setTimeout(function(){
592-
removeClass(document.body,"disable-pointer-events");
593-
},opts.transition+300);
594-
}
595584
return;
596585

597586
// Event type was click, not touch
@@ -620,13 +609,6 @@
620609
}
621610
},
622611

623-
/**
624-
* Enable pointer events
625-
*/
626-
_enablePointerEvents:function(){
627-
removeClass(document.body,"disable-pointer-events");
628-
},
629-
630612
/**
631613
* Adds the needed CSS transitions if animations are enabled
632614
*/
@@ -652,8 +634,7 @@
652634
savedHeight+=nav.inner[i].offsetHeight;
653635
}
654636

655-
// Pointer event styles are also here since they might only be confusing inside the stylesheet
656-
varinnerStyles="."+opts.jsClass+" ."+opts.navClass+"-"+this.index+".opened{max-height:"+savedHeight+"px !important} ."+opts.jsClass+" .disable-pointer-events{pointer-events:none !important} ."+opts.jsClass+" ."+opts.navClass+"-"+this.index+".opened.dropdown-active {max-height:9999px !important}";
637+
varinnerStyles="."+opts.jsClass+" ."+opts.navClass+"-"+this.index+".opened{max-height:"+savedHeight+"px !important} ."+opts.jsClass+" ."+opts.navClass+"-"+this.index+".opened.dropdown-active {max-height:9999px !important}";
657638

658639

659640
if(styleElement.styleSheet){

‎client/dist/responsive-nav.min.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎client/src/responsive-nav.js‎

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,6 @@
124124
}else{
125125
this.close();
126126
}
127-
128-
// Enable pointer events again
129-
this._enablePointerEvents();
130127
}
131128
},
132129

@@ -374,21 +371,19 @@
374371
},
375372

376373
/**
377-
* On touch start get the location of the touch
378-
* and disable pointer events on the body.
374+
* On touch start we get the location of the touch
379375
*
380376
*@param {event} event
381377
*/
382378
_onTouchStart:function(e){
383379
this._preventDefault(e);
384-
addClass(document.body,"disable-pointer-events");
385380
this.startX=e.touches[0].clientX;
386381
this.startY=e.touches[0].clientY;
387382
this.touchHasMoved=false;
388383

389384
/**
390385
* We remove mouseup event completely here to avoid
391-
* double triggeringof events.
386+
* double triggeringthe event.
392387
*/
393388
removeEvent(navToggle,"mouseup",this,false);
394389
},
@@ -402,7 +397,6 @@
402397
_onTouchMove:function(e){
403398
if(Math.abs(e.touches[0].clientX-this.startX)>10||
404399
Math.abs(e.touches[0].clientY-this.startY)>10){
405-
this._enablePointerEvents();
406400
this.touchHasMoved=true;
407401
}
408402
},
@@ -425,11 +419,6 @@
425419
// If the event type is touch
426420
if(e.type==="touchend"){
427421
this.toggle();
428-
if(opts.insert==="after"){
429-
setTimeout(function(){
430-
removeClass(document.body,"disable-pointer-events");
431-
},opts.transition+300);
432-
}
433422
return;
434423

435424
// Event type was click, not touch
@@ -458,13 +447,6 @@
458447
}
459448
},
460449

461-
/**
462-
* Enable pointer events
463-
*/
464-
_enablePointerEvents:function(){
465-
removeClass(document.body,"disable-pointer-events");
466-
},
467-
468450
/**
469451
* Adds the needed CSS transitions if animations are enabled
470452
*/
@@ -490,8 +472,7 @@
490472
savedHeight+=nav.inner[i].offsetHeight;
491473
}
492474

493-
// Pointer event styles are also here since they might only be confusing inside the stylesheet
494-
varinnerStyles="."+opts.jsClass+" ."+opts.navClass+"-"+this.index+".opened{max-height:"+savedHeight+"px !important} ."+opts.jsClass+" .disable-pointer-events{pointer-events:none !important} ."+opts.jsClass+" ."+opts.navClass+"-"+this.index+".opened.dropdown-active {max-height:9999px !important}";
475+
varinnerStyles="."+opts.jsClass+" ."+opts.navClass+"-"+this.index+".opened{max-height:"+savedHeight+"px !important} ."+opts.jsClass+" ."+opts.navClass+"-"+this.index+".opened.dropdown-active {max-height:9999px !important}";
495476

496477

497478
if(styleElement.styleSheet){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp