使用 z-index、php、xml 和 jquery/cycle.js 的密集幻灯片
所以我正在做这个项目,创意总监给了我一个难题。
他使用 flash 创建了一个原型,该原型需要使用 jQuery、XML(或 PHP)来构建,以拉入所有内容和图像,然后在相同的 div 尺寸内切换也通过 XML 拉入的更多信息。
我被允许最大程度地使用 JS,这意味着如果我使用 JS 拉取图像,我会给它们一个特定的命名约定。无需进一步告别:
http://joeylabs.com/sites/sgc/prototype/
顺便说一句,由于某种原因,此页面将幻灯片一直推到底部,因此要查看整个内容,只需滚动到底部即可。 :)
所以我的想法是:
- 通过 php 目录扫描脚本或使用图像命名约定使用 jquery 从文件夹中提取图像。
- 然后使用 Cycle.js 我创建一个变量,用于在 onBefore 中保存 li before 内的图像,并创建一个变量,用于在 onAfter 中保存 li after 内的图像,将它们分别浮动在 z-index 小于 1 的 div 中比当前幻灯片。 (我还不知道如何做到这一点)
- 当前幻灯片有一个百叶窗过渡,当用户单击“下一步”时,它会触发 2 张幻灯片,一张在下面,一张在上面。
目前这都是理论,但您不认为可以运行 2 个循环幻灯片,一个在另一个之上,用 1 个触发器吗?有人对此有什么想法、建议吗?
So I'm working on this project and the creative director has thrown a curveball my way.
He's created with flash a prototype that needs to be built with jQuery, XML (or PHP) pulling in all the content and images, and then within the same div dimensions toggle more information that's also pulled in via XML.
I'm allowed to use JS to the fullest extent which means if I'm pulling images with JS I'll give them a specific naming convention. Without further adieu:
http://joeylabs.com/sites/sgc/prototype/
Btw, for some reason this page pushes the slideshow all the way to the bottom so to view the entire thing just scroll to the bottom. :)
So what I'm thinking is:
- Pull images from folder via php directory scan script or with jquery using an image naming convention.
- Then using Cycle.js I'd create a variable that holds the image inside the li before with onBefore and a variable that holds the image inside the li after with onAfter, float both of them respectively in a div with a z-index 1 less than the current slide. (I don't know how to do this yet)
- The current slide has a blinds transition and when the user clicks NEXT it is a trigger for 2 slideshows, one below and one on top .
This is all theory at this point but don't you think it would be possible to run 2 Cycle slideshows, one on top of the other with 1 trigger? Anyone have thoughts, tips, on this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,我将每个 img 嵌套在两个 div 和两个 div 中以将其包裹起来...
并且:
“before_n_after_window”的子项是正在循环的 div:
幻灯片包装器(before_slide_wrapper 和 after_slide_wrapper)位于 Cycle() 下完全控制-很好。但是,嵌套在其中的任何内容都不是,因此您可以为幻灯片放置更多同级(before_slide 和 after_slide) - 因此是“#slide_comment”div。
“before_n_after_window”仅在cycle()的半控制下,并使用与其自身不冲突的CSS代码。 “#before_window_wrapper”和“#after_window_wrapper”由您完全控制(css-wise)。
现在您已经有了“#before_n_after_window”及其子项,只需迭代它们并命名并指向每对控件:
您必须遵循上面的命名约定或您可能决定的任何其他命名约定。实际的控件可以放置在除窗口内部之外的任何地方 - 错误问题。
附带说明一下,我将这些对设置为在循环后立即暂停,因为我不想在页面上运行多张幻灯片。我希望用户选择循环哪一个。另外,我必须找到一种方法来关闭可能正在运行的任何其他周期。
然而:
yes, I nested each of my img in two divs and two divs to wrap things up...
and:
the children of "before_n_after_window" are the divs that are being cycled:
The slide wrappers (before_slide_wrapper and after_slide_wrapper) are under cycle()'s complete control -fine. However, any thing nested inside of it is not, so you can place more siblings for the slides(before_slide and after_slide) - hence the "#slide_comment" div.
"before_n_after_window" is only under semi-control of cycle(), and uses your css code that doesn't conflict with its own. "#before_window_wrapper" and "#after_window_wrapper" are under your complete control(css-wise).
Now that you have"#before_n_after_window" and its children, simply iterate through them and name and point the controls for each pair:
You must follow the naming convention above or any other you may decide on. the actual controls can be be place anywhere except inside the windows - bug issues.
On a side note, I set these pairs to pause immediately after they've been cycled because I didn't want several slide running on on page. I wanted the user to choose which one to cycle. Also, I have to find a way to turn off any other cycles that may be running.
However:
我认为您不会进行任何目录抓取 - 您将从哪里获取有关每个图像的其余信息(标题、说明文字等)。您需要将每个部分放入数据库中,并参考图像,当用户单击“了解更多”按钮、部分名称、预览标题等时应打开哪个子部分。
我建议使用Galleria 插件:http://galleria.aino.se/
对于子页面(“了解更多”的目的地“按钮),您可以将其 AJAX 到您拉动的绝对 div 中以覆盖整个幻灯片放映。这使得关闭按钮很容易实现 - 它只是将绝对 div 全部删除。
I don't think you'll be doing any directory scraping - where are you going to get the rest of the information about each image from (title, caption, etc). You'll need to put each section in a database, with reference to the image, which subsection should be opened when the user clicks the "learn more" button, section name, preview caption, etc.
I would suggest using a variant of the Galleria plugin: http://galleria.aino.se/
For the subpages (the destination for the "learn more" button), you can AJAX that into an absolute div that you pull to cover the entire slide show. That makes the close button easy to implement - it just removes the absolute div all together.