jQuery循环幻灯片调整大小问题

发布于 2024-09-10 04:47:02 字数 407 浏览 7 评论 0原文

在此页面上,中间有一个 100% 宽度的启动屏幕,并且每 8 秒旋转一次图形图像。

我在这张幻灯片中有 3 个 div。主 div 包含幻灯片,内部 div 具有中继器背景图像,内部 div 包含渐变图像。

问题 1. 当您尝试缩小浏览器时...网站内容会自行调整并向左侧移动...但是我的幻灯片内容不会...目前我不这样做其中有内容,但您可以通过黑色边框看到它。幻灯片位于中间。

我该如何解决这个问题?

问题 2. 一旦浏览器宽度变小并且您加载此页面...幻灯片就会在中心呈现。现在最大化浏览器,您将看到因为幻灯片是在较小的屏幕中呈现的......它将在两侧留下空白,并且 div 不会随浏览器调整大小。

我对此非常反对,所以欢迎任何帮助和建议。

On this page I have a splash screen in the middle which is 100% width and it rotates graphical images every 8 sec.

I have 3 div inside this slideshow. Main div contains the slideshow , internal div has repeater background image and internal div inside that has gradient image.

Problem 1. When you try to make the browser smaller ....website content adjust themselves and shifts on the left side.....however my slideshow content does not...currently I do not have content in it but you can see this by the black border. Slideshow stays in the middle.

How do I solve this ?

Problem 2. Once the browser is smaller in width and you load this page....slideshow renders in the center. Now maximize the browser ,you will see the because slideshow was rendered in the smaller screen....it will leave white space on the sides and div wont resize with the browser.

I have banged my head against this so any help and suggestion is welcome.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

暮光沉寂 2024-09-17 04:47:02

我以前从未使用过 jquery.cycle,但它会根据渲染时的初始浏览器宽度调整宽度。调整浏览器大小后,这些宽度也不会调整,这导致了最终的问题。

查看您的 CSS,您似乎正在尝试直接为这些 div 设置 100% 的宽度(这不会生效,因为 jquery.cycle 直接将宽度应用于覆盖它的元素)。一个直接的解决方案是在 CSS 中的 div 元素的宽度之后立即指定 !important (强制元素直接使用您的 CSS)。

例如(让我们以第一个蓝色 div 为例):

.fadein {
   width: 100% !important
}

.hd_splash_container_blue {
   width: 100% !important
   poisition: relative;
}

.main_blue {
   margin-left:70px;
   margin-right:70px;
   position: relative;
} 

这应该允许您成功地调整浏览器大小,使内容根据需要居中。

我可能建议在更高的级别应用 CSS,因为每个高级别之间的唯一变化是图像(可以像现在一样完成)。取出其余的 CSS 并在较高级别上应用它:

.hd_splash_container {
   width: 100% !important
   poisition: relative;
}

.main_color {
   margin-left:70px;
   margin-right:70px;
   position: relative;
} 

I've never used jquery.cycle before, but its adjusting your width based on the initial browser width when it renders. Upon resizing the browser, these widths are not being adjusted either, which is causing your ultimate problem.

Viewing your CSS, it appears you're trying to set a width of 100% directly to these divs (which is not taking affect since jquery.cycle is applying a width directly to the element overriding it). An immediate solution is specifying !important immediately following your widths on the div elements in your CSS (enforcing that the elements use your CSS directly).

For example (lets take the first blue div):

.fadein {
   width: 100% !important
}

.hd_splash_container_blue {
   width: 100% !important
   poisition: relative;
}

.main_blue {
   margin-left:70px;
   margin-right:70px;
   position: relative;
} 

This should allow you to re-size the browser successfully keeping the contents centered as desired.

I might suggest applying your CSS at a higher level, since the only changes between each high level is the image (which can be done as it is now). Take the rest of the CSS out and apply it at a high level:

.hd_splash_container {
   width: 100% !important
   poisition: relative;
}

.main_color {
   margin-left:70px;
   margin-right:70px;
   position: relative;
} 
甜中书 2024-09-17 04:47:02

我相信使用 Cycle 插件的本机选项实际上可以实现相同的效果。尝试添加这些规则,如下所示:

$('#slides').cycle({ 
  resizeContainer: false,
  slideResize: false
});     

I believe the very same affect can actually be achieved using the native options of the Cycle plugin. Try adding these rules like so:

$('#slides').cycle({ 
  resizeContainer: false,
  slideResize: false
});     
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文