Swiper中文论坛
标题:
给li添加的点击事件 移动端点击不了
[打印本页]
作者:
sonnenlichtyy
时间:
2018-11-14 15:51
标题:
给li添加的点击事件 移动端点击不了
微信图片_20181114154834.png
(115.42 KB, 下载次数: 201)
下载附件
保存到相册
2018-11-14 15:50 上传
<
div
class
=
"swiper-slide bg_grad"
data-hash
=
"slide2"
>
<
div
class
=
"test_box"
>
<
div
class
=
"question_box"
>
<
p
class
=
"q_box"
>
1、你喜欢什么?
</
p
>
</
div
>
<
div
class
=
"answer_box"
>
<
ul
class
=
"answer_ul"
>
<
li
class
=
""
>
<
p
class
=
"ans_box"
>
纸类
</
p
>
</
li
>
<
li
>
<
p
class
=
"ans_box"
>
玻璃
</
p
>
</
li
>
<
li
>
<
p
class
=
"ans_box"
>
塑料
</
p
>
</
li
>
<
li
>
<
p
class
=
"ans_box"
>
金属
</
p
>
</
li
>
</
ul
>
</
div
>
<
div
class
=
"submit_box"
>
<
ul
class
=
"sub_ul"
>
<
li
>
<
a
href
=
"javascript:;"
class
=
"prev-btn swiper-button-prev"
>
<
img
src
=
"../test_img/test_prev.png"
alt
=
""
class
=
"i_img5"
>
</
a
>
</
li
>
<
li
>
<
a
href
=
"javascript:;"
class
=
"next-btn swiper-button-next"
>
<
img
src
=
"../test_img/test_next.png"
alt
=
""
class
=
"i_img5"
>
</
a
>
</
li
>
</
ul
>
</
div
>
</
div
>
</
div
>
<!-- Swiper JS -->
<
script
src
=
"../js/swiper.min.js"
>
<
/
script
>
<
script
src
=
"../js/jquery.min.js"
>
<
/
script
>
<!-- Initialize Swiper -->
<
script
>
var
swiper
=
new
Swiper
(
'.swiper-container'
, {
navigation:
{
nextEl:
'.swiper-button-next'
,
prevEl:
'.swiper-button-prev'
,
},
loop:
false
,
hashNavigation:
true
,
preventClicks:
true
,
});
<
/
script
>
<
script
>
$
(
function
() {
$
(
".answer_ul li"
).
click
(
function
() {
$
(
this
).
siblings
().
removeClass
(
"on_active"
);
$
(
this
).
addClass
(
"on_active"
);
});
});
<
/
script
>
欢迎光临 Swiper中文论坛 (http://bbs.swiper.com.cn/)
Powered by Discuz! X3.2