简体   繁体   English

jQuery Max-Width语句

[英]Jquery Max-Width statement

I'm trying to open up my iframe in a lightbox with a maximum width of 700px but when the screen's smaller then that, it'll be 100%. 我正在尝试在最大宽度为700px的灯箱中打开iframe,但是当屏幕较小时,它将为100%。

this works at setting the width a fixed 700 这可以将宽度固定为700

$(".iframe").colorbox({iframe:true, width:"700px", height:"800px"});

But everytime i try to do this 但是每次我尝试这样做

$(".iframe").colorbox({iframe:true, width:"100%", max-width:"700px", height:"800px"});

the iframe lightbox doesn't work... it just opens up like a normal page... any clues guys? iframe灯箱不起作用...就像普通页面一样打开...有任何提示吗?

Javascript objects don't allow special characters in object keys that aren't quoted. Javascript对象不允许在未加引号的对象键中使用特殊字符。 max-width would qualify, and thus throw an error. max-width将合格,并因此引发错误。 Look in your browser console 在浏览器控制台中查看

This error will block code from running 此错误将阻止代码运行

If you look at the plugin docs, the correct option to use is: maxWidth 如果您查看插件文档,则使用的正确选项是: maxWidth

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM