Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/385.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jquery在打开滑动面板后重新加载iframe_Javascript_Jquery_Iframe_Panel - Fatal编程技术网

Javascript jquery在打开滑动面板后重新加载iframe

Javascript jquery在打开滑动面板后重新加载iframe,javascript,jquery,iframe,panel,Javascript,Jquery,Iframe,Panel,两个问题: 您在单击事件(这不是必需的)中有一个返回false,而且它在reload语句之前。所以它永远不会执行 getElementById(shoutbox)的id应该用引号括起来 这样,即使在slideUp过程中,您也总是要重新加载iframe 试试这个: $(document).ready(function(){ $(".trigger").click(function(){ $(".shoutpanel").toggle("fast"); $(this).toggl

两个问题:

  • 您在单击事件(这不是必需的)中有一个返回false,而且它在reload语句之前。所以它永远不会执行
  • getElementById(shoutbox)的id应该用引号括起来
  • 这样,即使在slideUp过程中,您也总是要重新加载iframe
试试这个:

$(document).ready(function(){
$(".trigger").click(function(){
    $(".shoutpanel").toggle("fast");
    $(this).toggleClass("active");
    return false;
            document.getElementById(shoutbox).contentDocument.location.reload(true);
});
});

工作得很好。谢谢!
$(document).ready(function(){
$(".trigger").click(function(){
    $(".shoutpanel").toggle("fast");
    $(this).toggleClass("active");
    return false;
            document.getElementById(shoutbox).contentDocument.location.reload(true);
});
});
$(document).ready(function () {
    $(".trigger").click(function () {
        $(".shoutpanel").toggle("fast", function () { //Use toggle's complete function 
            if ($(this).is(':visible')) {   // check if this is in visible mode
              document.getElementById("shoutbox")
                    .contentDocument.location.reload(true); //reload the iframe
            }
        });
        $(this).toggleClass("active");

    });
});