gpt4 book ai didi

jquery - Fancybox: 100% 宽度 -100px

转载 作者:行者123 更新时间:2023-11-28 09:27:20 25 4
gpt4 key购买 nike

我目前正在尝试找到一种方法来在我的屏幕的整个宽度上显示 FancyBox,左边有 100 像素的边距。我试过了

jQuery

$(document).ready(function() {
$(".fancybox").fancybox({
'width': '100%'
});
});

CSS

.fancybox-wrap {
position: absolute;
left: 100px;
}

好的,这工作正常,但现在我的浏览器中有一个水平滚动条,这是由 100% + 100px 宽度引起的。

我现在想知道的是,有没有办法让 100% 的浏览器宽度减去 100 像素?我试过了,但没用:

jQuery

$(document).ready(function() {
$(".fancybox").fancybox({
'width': (100% - 100) + "px"
});
});

如果有人能提供一些可用的代码行,那就太好了,我完全不擅长编码。 TY.

最佳答案

无需编辑任何 css,fancybox 为您提供选项

$(".fancybox").fancybox({
width: "100%",
margin: [0, 0, 0, 100] // top, right, bottom, left
});

关于jquery - Fancybox: 100% 宽度 -100px,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20169210/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com