简体   繁体   English

如何滑出旧的div并在循环中带有文本内容的新div中滑动?

[英]How to slide out old div and slide in new div with text content in loop?

How to make two divs so that after clicked button old div is slade out and new div with new content is slide in? 如何制作两个div,以便点击按钮后的旧div是slade out和新的div与新内容滑入?

My conception but not aligned inline : jsfiddle 我的构思但没有对齐inlinejsfiddle

I found something similar to my conception but for my solution I need infinity loop with dynamically added content: example 1 or example 2 我找到了类似于我的概念的东西但是对于我的解决方案,我需要动态添加内容的无限循环: 示例1示例2

There were a few changes I made to the existing code and CSS, but this should do what you want. 我对现有代码和CSS做了一些更改,但这应该做你想要的。 I also added a check to the reset button to ensure that the slideOut is not already hidden. 我还在重置按钮上添加了一个检查,以确保slideOut尚未隐藏。 Otherwise, the animation will unhide the element and hide it again. 否则,动画将取消隐藏元素并再次隐藏它。

It is better to put things into the jQuery $(document).ready() function to ensure that all of your elements have been loaded before trying to use them. 最好将东西放入jQuery $(document).ready()函数中,以确保在尝试使用它们之前已经加载了所有元素。

New Fiddle Link 新的小提琴链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM