Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/459.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 滑动和滑动菜单以宽度百分比关闭_Javascript_Jquery_Menu_Swipe - Fatal编程技术网

Javascript 滑动和滑动菜单以宽度百分比关闭

Javascript 滑动和滑动菜单以宽度百分比关闭,javascript,jquery,menu,swipe,Javascript,Jquery,Menu,Swipe,我正在使用“滑动和滑动”菜单,但在如何使用切换按钮关闭菜单时遇到了问题。由于某些原因,在代码段中,我无法让它执行与我相同的操作,但在代码段中,菜单根本没有关闭。在我的页面上,菜单仅关闭280px 我最初认为速度参数,speed:280,是造成这种情况的原因,但我尝试将其更改为100%,但没有成功 我的菜单使用的是百分比宽度,而不是像素宽度。这可能是导致此问题的原因 有人知道为什么菜单没有关闭或没有关闭我菜单的整个宽度% !函数(factory){“函数”==typeof define&&de

我正在使用“滑动和滑动”菜单,但在如何使用切换按钮关闭菜单时遇到了问题。由于某些原因,在代码段中,我无法让它执行与我相同的操作,但在代码段中,菜单根本没有关闭。在我的页面上,菜单仅关闭280px

我最初认为速度参数,
speed:280,
是造成这种情况的原因,但我尝试将其更改为100%,但没有成功

我的菜单使用的是百分比宽度,而不是像素宽度。这可能是导致此问题的原因

有人知道为什么菜单没有关闭或没有关闭我菜单的整个宽度
%

!函数(factory){“函数”==typeof define&&define.amd&&define.amd&&define.amd.jQuery?define([“jQuery”]),factory:factory(“未定义”!=typeof module&&module.exports?require(“jQuery”):jQuery}(函数($){“use strict”;函数init(options){return!options | void 0!==options.allowPageScroll | void 0==options.swipeStatus||(options.allowPageScroll=NONE),void 0!==options.click&&void 0==options.tap&(options.tap=options.click),options | |(options={}),options=$.extend({},$.fn.swipe.defaults,options),this.each(function(){var$this=$(this),plugin=$this.data(plugin=$this,options))(plugin=new touchwipe,this,options),$this)函数touchwipe}(元素,选项){function touchStart(jqEvent){if(!(getTouchInProgress()| |$(jqEvent.target).最近的(options.excludedElements,$element).length>0){var event=jqEvent.originalEvent?jqEvent.originalEvent:jqEvent;if(!event.pointerType | | | mouse”!=event.pointerType | | | 0!=options.fallbackToMouseEvents){ret,touch=Events=Events.touch,touch=Events.touch,evt=to:event;return phase=phase\u START,touchs?fingerCount=touchs.length:options.preventDefaultEvents!=!1&&jqEvent.preventDefault(),距离=0,方向=null,当前方向=null,pinchDirection=null,持续时间=0,startTouchesDistance=0,pinchZoom=1,pinchDistance=0,maximumsMap=createMaximumsData(),取消多指删除(),createFingerData(0,evt),!Touchs | | fingerCount==options.fingers | | options.fingers==ALL | | | | | | hasPinches()?(startTime=getTimeStamp(),2==fingerCount&(createFingerData(1,Touchs[1]),startTouchesDistance=endTouchesDistance=calculateTouchesDistance(fingerData[0]。开始,fingerData[1]。开始)),(options.swipeStatus | | options.pinchStatus)&&(ret=triggerHandler(event,phase)):ret=!1,ret===!1?(phase=phase\u CANCEL,triggerHandler(event,phase,ret):(options.hold&&(holdTimeout=setTimeout($.proxy(function(){$element.trigger(“hold”,[event.target]),options.hold&(ret=options.call($element,event,event.target))},this),options.longTapThreshold)),setTouchInProgress(!0),null}函数touchMove(jqEvent){var event=jqEvent.originalEvent?jqEvent.originalEvent:jqEvent;if(phase!==phase\u END&&phase!==phase\u CANCEL&&!inMultiFingerRelease()){var ret,touchs=event.touchs,evt=touchs?touchs[0]:事件,currentFinger=updateFingerData(evt);if(endTime=getTimeStamp(),toucks&&fingerCount=touchs.length),options.hold&&clearTimeout(holdTimeout),phase=phase\u MOVE,2==fingerCount&&(0==StartTouchsDistance?(createFingerData(1,Touchs[1]),StartTouchsDistance=endTouchesDistance=calculateTouchesDistance(fingerData[0]。开始,fingerData[1]。开始):(updateFingerData(Touchs[1]),endTouchesDistance=calculateTouchesDistance(fingerData[0]。结束,fingerData[1]。结束),pinchDirection=calculatePinchDirection(fingerData[0].end,fingerData[1].end)),pinchZoom=calculatePinchZoom(StartTouchsDistance,EndTouchsDistance),pinchDistance=Math.abs(StartTouchsDistance EndTouchsDistance)),fingerCount==options.fingers | | options.fingers==ALL| fingers | | |!Touchs | hasPinches(){if(方向=CalculatedDirection=CalculatedDirection(currentFinger.start,currentFinger.end),currentDirection=calculateDirection(currentFinger.last,currentFinger.end),ValidatedFaultEvent(jqEvent,currentDirection),distance=CalculatedInstance(currentFinger.start,currentFinger.end),duration=CalculatedOration(),setMaxDistance(方向,距离),ret=triggerHandler(事件,阶段),!options.triggeroTouchEnd | | options.triggeroTouchLeave){var inBounds=!0;if(options.triggeroTouchLeave){var bounds=getbounds(this);inBounds=isInBounds(currentFinger.end,bounds)}!options.triggeroTouchEnd&&inBounds?phase=getNextPhase(phase_MOVE):options.triggeroTouchLeave&&!inBounds&&phase=getNextPhase(phase(phase(end)),phase!=phase_CANCEL&&phase!=phase|END | triggerHandler(event,phase)}else phase=phase_CANCEL,triggerHandler(event,phase);ret==!1&&(phase=phase_CANCEL,triggerHandler(event,phase))}函数touchEnd(jqEvent){event=jqEvent.originalEvent?jqEvent.originalEvent:jqEvent,touchs=event.touchs.touchs;if(touchs){)if(touch.length&!inmultigingerelease())return startMultiFingerRelease(事件),!0;if(touch.length&&inMultiFingerRelease())return!0}return inMultiFingerRelease()&&&(fingerCount=fingerCountAtRelease),endTime=getTimeStamp(),duration=calculateDuration(),didSwipeBackToCancel()| | |!validateSwipeDistance()?(阶段=阶段\取消,触发器处理程序(事件,阶段)):options.TriggeroTouchEnd | | options.TriggeroTouchEnd===!1&&phase===阶段移动?(options.preventDefaultEvents!==!1&&jqEvent.preventDefault(),phase=phase,triggerHandler(事件,阶段)):!options.TriggeroTouchEnd&&hasTap()(phase=phase,TriggerHandlerForesture(事件,阶段,阶段)):phase==阶段移动和阶段取消,triggerHandler(事件,阶段)),setTouchInProgress(!1),null}函数touchCancel(){fingerCount=0,endTime=0,startTime=0,startTouchesDistance=0,endTouchesDistance=0,pinchZoom=1,CancelMultiPingErrorRelease(),setTouchInProgress(!1)}函数touchLeave(jqEvent){事件=jqEvent.OriginaleEvent?jqEvent.OriginaleEvent.OriginaleEvent:jqEvent;选项。TriggerTouchLeave&(phase=getNextPhase)(phase=getNextPhase)(phase_结束)函数removeListeners(){$element.unbind(START_EV,touchStart),$element.unbind(CANCEL_EV,touchCancel),$element.unbind(MOVE_EV,touchMove),$element.unbind(END_EV,touchEnd),LEAVE_EV&$element.unbind(LEAVE_EV,touchLeave),set