Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.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 调整色盒大小不起作用!_Javascript_Jquery_Colorbox - Fatal编程技术网

Javascript 调整色盒大小不起作用!

Javascript 调整色盒大小不起作用!,javascript,jquery,colorbox,Javascript,Jquery,Colorbox,我加载了一个带有网站另一个页面内容的colorbox模式(官方演示中的AJAX示例)。此页面有一个Show more按钮,单击该按钮可显示更多内容。我还添加了其他代码,试图调整模式大小以显示所有内容 代码: $("#button_writereview").colorbox.resize(); $("#button_writereview").colorbox.resize({innerWidth:560, innerHeight:750}); $("#button_writereview"

我加载了一个带有网站另一个页面内容的colorbox模式(官方演示中的AJAX示例)。此页面有一个
Show more
按钮,单击该按钮可显示更多内容。我还添加了其他代码,试图调整模式大小以显示所有内容

代码:

$("#button_writereview").colorbox.resize();

$("#button_writereview").colorbox.resize({innerWidth:560, innerHeight:750});

$("#button_writereview").colorbox.resize({Width:560, Height:750});

$.colorbox.resize();

$.colorbox.resize({innerWidth:560, innerHeight:750});

$(this).colorbox.resize(); 

$.fn.colorbox.resize();

$('#button_writereview').css('height',500);
上述代码除了抛出一个错误之外,没有任何其他作用
uncaughttypeerror:无法调用未定义的方法“resize”


我就是想不出答案!!我猜从模式中的点击事件调用父页面是个问题。

这里有一些与我无关的建议,但你可以尝试一下,它们很长,不能出现在评论中,所以我做了一个答案,请大家在投票之前先想一想

  • 可能存在jquery冲突,因为每个人都喜欢
    $
    ,不管怎样,您都可以像这样使用jquery noConflict

    <script type="text/javascript" src"/Scripts/jquery-1.6.2.min.js"></script>
        <script type="text/javascript"> 
            jq = jQuery.noConflict(true); 
     </script>
    
    
    jq=jQuery.noConflict(true);
    
  • 现在使用
    jq
    而不是
    $

  • 把你的代码包在里面

    $(函数(){

    }))

  • 确保jquery.js和colorbox.js都已加载,有时它们包含在页面标题中,但未加载


  • 你的网站上有其他JS框架吗?你有没有包括colorbox
    JS
    ?你的答案可能是duh!是的,但有时也会发生这样的事情,请确保在jqueryup之后以及jquery之后都包含了colorbox
    js
    。在加载到模式的html文件中加载colorbox js和不加载colorbox js都存在相同的问题。