这听起来可能很愚蠢,但我是一个 Jquery 菜鸟,当我在移动设备上左右滑动时,我正在尝试制作一个 div 标签来调整大小,我不知道为什么它只执行一次?这里的任何 jquery 大师都可以帮助我吗!!!谢谢你
这是代码
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
</head>
<body>
<div class="box">
</div>
<script>
$(function right(){
// Bind the swiperightHandler callback function to the swipe event on div.box
$( "div.box" ).on( "swiperight", swiperightHandler );
// Callback function references the event target and adds the 'swiperight' class to it
function swiperightHandler( event ){
$( event.target ).addClass( "swiperight" );
}
});
$(function left(){
// Bind the swiperightHandler callback function to the swipe event on div.box
$( "div.box" ).on( "swipeleft", swiperightHandler );
// Callback function references the event target and adds the 'swiperight' class to it
function swiperightHandler( event ){
$( event.target ).addClass( "swipeleft" );
}
});
</script>
</body>
</html>