javascript – 使Business Catalyst Lightbox响应
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了javascript – 使Business Catalyst Lightbox响应,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2022字,纯文字阅读大概需要3分钟。
内容图文
![javascript – 使Business Catalyst Lightbox响应](/upload/InfoBanner/zyjiaocheng/818/dd3a4a3287bf45bc8418d168acf94452.jpg)
我一直试图弄清楚如何使BC的照相馆灯箱响应.我不知道他们为什么不首先让它反应灵敏,但无论如何.这是我正在处理的网页:http://ladyilgphotography.businesscatalyst.com/family-photography
这是我到目前为止所拥有的.
<script>
$('body').click(function() {document.getElementById('outerImageContainer').onclick=function(){
var elem = document.getElementById('outerImageContainer');
var newWidth = 0;
var newHeight = 0;
var w = parseInt(elem.style.width);
var h = parseInt(elem.style.height);
var ratio = parseInt(w / h);
newWidth = window.innerWidth - 80;
alert(newWidth);
newHeight = parseInt(newWidth * ratio);
elem.style.width = newWidth + 'px';
elem.style.height = newHeight + 'px';
};});
</script>
我敢肯定这不是最干净的解决方案,也不是最有效的解决方案,但它确实有效!
问题是脚本在加载图片后立即运行,然后运行Business Catalyst的脚本,之后重置我的函数设置的值.
我想到的另一个解决方案就是向“#outerImageContainer”添加95%的最大宽度,但是当我这样做时,它会在几次点击图库后开始崩溃,图像开始向前移动越来越远灯箱包装保持不变的页面.
最后,我尝试使用另一个照片库插件,但唯一的问题是像漂亮的照片或照片的插件只针对页面上加载的图像,但在我的情况下,图库中的图像比显示在页面上.
再次总结一下我的咆哮,我怎样才能使BC的灯箱响应,以便宽度和高度都与上载的图像相匹配?
解决方法:
我使用这几个CSS规则来强化BC的Lightbox模式弹出窗口的流体大小:
#outerImageContainer {
max-width: 90%;
overflow: hidden;
height: auto !important;
}
#imageDataContainer {
max-width: 90%;
overflow: hidden;
}
#lightboxImage {
max-width: 100%;
}
无需其他JS或HTML更改.这是一个快速视频演示:http://gfycat.com/GraveUntriedGuineapig.
Another solution that I thought about was just to add a 95% max-width to the “#outerImageContainer”, but when I do that, it starts breaking down after a few clicks through the gallery and the image starts shifting farther and farther down on the page while the lightbox wrapper stays the same.
我无法在Chrome,Firefox或IE11上重现这一点.可能是页面上的其他JS / CSS吗?它出现在哪些浏览器中?
编辑:由于@nvncbl,“增长高度”问题的解决方法:将font-size:0!important应用于#outerImageContainer.
内容总结
以上是互联网集市为您收集整理的javascript – 使Business Catalyst Lightbox响应全部内容,希望文章能够帮你解决javascript – 使Business Catalyst Lightbox响应所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。