Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.4k views
in Technique[技术] by (71.8m points)

jq中 $this,在setTimeout中不起作用请问有办法解决吗

$.each(lis, function(index, item) {
    if ((mTop + 630) < swHeight && dItem > lastItem) {

        setTimeout(setTimeHide(){
            //这边不起做用请问怎么解决啊谢谢
            $(this).find('.item-right-img-p-r').hide();
        },600)
    }
});

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
$.each(lis, function(index, item) {
    if ((mTop + 630) < swHeight && dItem > lastItem) {
        var oThis = $(this)
        setTimeout(setTimeHide(){
            //这边不起做用请问怎么解决啊谢谢
            oThis.find('.item-right-img-p-r').hide();
        },600)
    }
});

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...