全屏 jQuery Cycle,调整窗口大小
我正在尝试使用 jQuery Cycle 构建幻灯片,其中图像填充整个浏览器,并进行调整,以便它们始终居中并在单击时水平滚动(scrollHorz)。
这一切都工作得很好,但是当我调整浏览器窗口大小时,滚动距离不会根据图像的缩放进行调整。
这样的调整能够完成吗?这是我的源代码: http://jsfiddle.net/taifun/GWrbB/
我知道我可以修复使用 $(window).resize 事件缩放当前图像,但这不是问题。
任何建议将不胜感激。
I'm trying to build a slideshow with jQuery Cycle where the images fills the entire browser, are adjusted so they're always centered and scrolls horizontally (scrollHorz) on click.
It all works pretty good, but when I adjust browser window size, the scroll distance is not adjusted according to the scaling of the image.
Can such adjustment be accomplished? Here's my source code: http://jsfiddle.net/taifun/GWrbB/
I know I can fix scaling of current image by using the $(window).resize event but that's not the problem.
Any suggestions will be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看看 Maximage 2.0…它使用 jQuery Cycle 插件来创建全屏背景幻灯片。看起来它符合您的要求。
http://www.aaronvanderzwan.com/blog/ 2011/11/maximage-2-0-beta1-release/
Take a look at Maximage 2.0… it uses jQuery Cycle plugin to create fullscreen background slideshows. Looks like it does what you are looking for.
http://www.aaronvanderzwan.com/blog/2011/11/maximage-2-0-beta1-release/
调整大小后,您需要根据屏幕宽度调整滚动距离(左或边距左)。我不确定循环使用什么属性来执行此操作。就像在调整大小后调整图像大小一样,您也需要设置起始位置。
You need to adjust the scroll distance (left or margin-left) based on the screen width after resize. I am not sure what attribute cycle uses to do this. Much like you are resize the image after resize you'll also need to set the start position.