我创建了以下代码,该代码适用于.on
函数所需的内容,但当我点击#close_box
链接时,如何设置.on
到{{{}}的内容除非我点击.off
链接?
.mcndiv

$(document).ready(function() {
$(".mcndiv").click(function() {
// Bind the swipeHandler callback function to the swipe event on div.box
$("#mc-container").on("swipeleft", swipingLeft);
$("#mc-container").on("swiperight", swipingRight);
// Callback function references the event target and adds the 'swipe' class to it
function swipingLeft() {
$('#mcnumbers-links #mcnumbers-colours a.mcselected').removeClass('mcselected')
}
function swipingRight() {
$('#mcnumbers-links #mcnumbers-colours a.mcselected').addClass('mcselected')
}
$('#close_box').click(function() {
$("#mc-container").off("swipeleft", swipingLeft);
$("#mc-container").off("swiperight", swipingRight);
});
});
});

.mcselected {
background: blue;
}
a {
width: 50px;
height: 50px;
display: block;
background: green;
}
.mcndiv {
width: 100px;
height: 50px;
background: red;
color: white
}

修改
我试图让移动jquery在示例中工作,但是它在我的localhost网站上没有工作..它是?但是如果有意义的话,试图让.on成为.off?所以,如果我在点击#close_box后滑动它什么都不做?
谢谢堆:)