douzhi2017 2015-11-16 08:22
浏览 52

在悬停函数jquery中调用ajax函数后有bug

I update partial of html page by call ajax function Every 5 Minutes, there are some element object in partial that by hover on open a popup windows.

my code run the first one works fine, but after a update Does not work properly and per-hover opens two popup window.(hover function call twice)

index.php

<script type="text/javascript">
    function refresh2() { <? php
        echo CHtml::ajax(array(
            'url' = > CController::createUrl("browsingpap/UpdateAjax"),
            'update' = > '#type', )) ?>
    }
    window.setInterval("refresh2()", 300000);
</script>
<div id="type">
    <!-- update here after call ajax function--->
</div>

updateAjax

<script type="text/javascript">
    $(document).ready(function() {
        $("#goli").hover(function() {
            $('#popup5').bPopup();
        });
    });
</script>
<div id="popup5" style="display: none;"> <span class="button b-close"><span>X</span></span>
    <div class="content">popup window</div>
    <div id="goli">hover me for show a popup</div>
</div>
  • 写回答

1条回答 默认 最新

  • dongwenghe2416 2015-11-29 11:58
    关注

    Try to do this and see if it help:

    $("#goli").unbind('hover').bind('hover',function() {
                $('#popup5').bPopup();
    });
    

    Anyway it will help us to see what is goig wrton if you will post the rest of your relevant code.

    评论

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?