.next() 的奇怪行为和 jQuery 的简单幻灯片
Strange Behaviour with .next() and a Simple Slideshow with jQuery
我已经用这个用头撞墙几个小时了 - 没有运气。简而言之,我似乎无法从 next() jQuery 方法中获得所需的功能。我正在尝试在单击图像时使 DOM 中的下一个 img 标签出现。
$(images).each(function(i){
$('#images').append($(this).css({
'display':(i) ? 'none' : 'in-line'
}).click(function(){
$(this).next().css({'display':'in-line'});
$(this).css({'display':'none'});
}));
});
所需的图像消失,但"next()"图像不显示。有什么大创意?这是环境:
<div id="images">
<img src="imgs/1.jpg" style="width: 333.33333333333337px; height: 500px; position: absolute; top: 50%; left: 50%; margin-top: -250px; margin-left: -166.66666666666669px; display: none; ">
<img src="imgs/2.jpg" style="width: 333.3333333333333px; height: 500px; position: absolute; top: 50%; left: 50%; margin-top: -250px; margin-left: -166.66666666666666px; display: none; ">
<img src="imgs/3.jpg" style="width: 333.3333333333333px; height: 500px; position: absolute; top: 50%; left: 50%; margin-top: -250px; margin-left: -166.66666666666666px; display: none; ">
<img src="imgs/4.jpg" style="width: 333.3333333333333px; height: 500px; position: absolute; top: 50%; left: 50%; margin-top: -250px; margin-left: -166.66666666666666px; display: none; ">
<img src="imgs/7.jpg" style="width: 500px; height: 333.3333333333333px; position: absolute; top: 50%; left: 50%; margin-top: -166.66666666666666px; margin-left: -250px; display: none; ">
</div>
这与这些元素是通过jQuery动态创建的事实有关吗?值得注意的是,动态创建的元素的迭代只有在加载图像后才会启动。
谢谢。
它的inline
不in-line
$(this).next().css({'display':'inline'});
相关文章:
- jQuery简单分页
- 'Alajax' Jquery 简单表单提交.如果表单未经验证,如何防止提交
- PHP-Jquery-简单模式的开放数据
- 获取打开的选项卡标题 jquery 简单 UI
- Jquery简单菜单
- 使用jQuery(简单文本编辑器)为文本区域添加值
- Jquery简单脚本只能在本地工作.为什么?像Javascript翻译
- Javascript/Jquery 简单的用户体验函数
- 如何使用jQuery简单地删除非嵌套文本的字符
- jQuery简单的工具提示即使事件被触发也不会显示
- jquery简单的图片幻灯片,用于网站上的多个幻灯片
- jquery简单的计算脚本几乎不需要帮助
- ajax jquery简单获取请求
- PHP与jQuery简单上传与进程栏
- JQuery简单切换不起作用
- Jquery简单if语句混淆
- jQuery简单碰撞错误,
- jQuery简单按钮绑定
- jQuery简单滑动器先前的问题
- jQuery简单的可折叠Div