简体   繁体   中英

add/removeClass doesn`t work on iPhone

This works correctly on browser but doesn't work on iPhone. Also I used the

var $event = ($ua.match(/(iPod|iPhone|iPad)/i)) ? "touchstart" : "click";

It also doesn`t work on iPhone

HTML

<button class="btn btn_mod" onclick="mod()">
<div class="mod_seciton">
    <p>hello</p>
</div>

CSS

.mod_section.active{
    display:none;
}
.mod_section{
    display:block;
}

JQuery

function mod(){
    $('.mod_section').addClass('active');
}

Try this:

$( ".btn_mod" ).click(function() {
     mod();
     alert("just for your own test..");
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM