Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/421.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 图像不是';t在colorbox中加载页面时加载_Javascript_Jquery_Html_Css - Fatal编程技术网

Javascript 图像不是';t在colorbox中加载页面时加载

Javascript 图像不是';t在colorbox中加载页面时加载,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我在正确加载时遇到了一些问题,因为图像有时无法显示,而它只是一个小的白色框,所有设置都正确吗?-它一直在工作,但我不明白为什么它不再工作了 <script type="text/javascript"> jQuery(document).ready(function(){ if (document.cookie.indexOf('visited=true') == -1) { var fifteenDays = 1000*60*60*2

我在正确加载时遇到了一些问题,因为图像有时无法显示,而它只是一个小的白色框,所有设置都正确吗?-它一直在工作,但我不明白为什么它不再工作了

<script type="text/javascript">
    jQuery(document).ready(function(){
        if (document.cookie.indexOf('visited=true') == -1) {
            var fifteenDays = 1000*60*60*24*15;
            var expires = new Date((new Date()).valueOf() + fifteenDays);
            document.cookie = "visited=true;expires=" + expires.toUTCString();
            $.colorbox({width:"30%", inline:true, href:"#subscribe"});
        }
        });
</script>
<div style="display:none;">
    <div id="subscribe" style="width:475px;">
        <img src="<?= IMAGES_DIR; ?>/signup.jpg" alt="Sign Up To University Compare" />
    </div>
</div>

jQuery(文档).ready(函数(){
if(document.cookie.indexOf('visted=true')=-1){
变量五天=1000*60*60*24*15;
var expires=新日期((新日期()).valueOf()+五个星期);
document.cookie=“visited=true;expires=“+expires.toutString();
$.colorbox({width:“30%”,inline:true,href:“#subscribe”});
}
});
/signup.jpg“alt=”注册到大学比较“/>

要查看实时链接,请访问:

位于
.cboxLoadedContent
有一个属性
高度:0px;


这就是问题所在。请尝试更改其值,这样会起作用。

我认为问题存在,因为当图像未完全加载时,颜色框会计算其高度(
高度:0
)。因此,请在加载完成后尝试调整其大小或为其指定高度值

$.colorbox({ 
    width:"30%", 
    inline:true, 
    href:"#subscribe",
    onComplete : function() { 
       $(this).colorbox.resize(); 
    }    
});


是否尝试删除
style=“display:none;“
?第二个可行,但我必须为宽度设置px大小,谢谢你,蒂迪·吉
$.colorbox({ 
    width:"30%", 
    inline:true, 
    href:"#subscribe",
    height: "500px"
});