0
你好家伙,我希望你能帮我解决我的问题我在我的销售类别中构建一个CRUD。当计时器达到使用jquery和php时获取最后一个id
的scenrios是:
如果用户鼠标悬停在一个特定的行,其意见和评论框会出现below.Usingthe jQuery的淡入()
而且用户可以输入他/她对该特定行的评论。
我的问题是,如果我意外地将鼠标盘旋下来,它指向其他评论。所以我创建了一个定时器,在这个定时器中,如果用户将鼠标悬停在该行中的时间超过3秒,那么无论有多少悬停在行上,该行的注释都会出现。
$(函数(){
var counter = 0; var myInterval = null; $(".hover_comment").hover(function(e){ //this is the first hover with an ID counter = 0; myInterval = setInterval(function(){ ++counter; console.log(counter); }, 1000); var salesid = $(this).find('span').text(); //SET IT TO VARIABLE $(".comment_boxes").hide(); setTimeout(function(){$(".comment_box_"+salesid).fadeIn()}); $('#txt_id').val(salesid); //SHOW THE COMMENT FORM $(this).find(".tempid").val(); $("#comment_add") .show(); },function(e){ //HERE'S THE FUNCTION WHEN I MOUSEOUT //CALL AGAIN var salesid = $(this).find('span').text(); $(".comment_boxes").hide(); setTimeout(function(){$(".comment_box_"+salesid).fadeIn()}); $('#txt_id').val(salesid); $(this).find(".tempid").val(); $("#comment_add") .show(); clearInterval(myInterval); if(counter > 3){ //IF TIMER REACHED GREATER THAN TO 3 SECONDS THE ID SHOULD BE PLACE IN A VARIABLE AND DISPLAY ITS CONTENTS //alert(salesid); var thisid = salesid; $(".comment_boxes").hide(); setTimeout(function(){$(".comment_box_"+thisid).fadeIn()}); $('#txt_id').val(salesid); $(this).find(".tempid").val(); $("#comment_add") .show(); }else{ //IF NOT CONTINUE TO HOVER } });
});
这是我的代码,我希望你能帮助我。
好的谢谢你的提醒我是新来的。对不起。 – rochellecanale