【发布时间】:2010-03-17 13:42:20
【问题描述】:
我创建了一个 jQuery 脚本(在帮助下),效果很好,但是我需要它在不使用点击功能的情况下自动/动画化,我只是想知道这是否可能,如果可以,如何?类似于幻灯片。
基本上,该代码允许我单击图像并隐藏/显示 DIV,同时更改元素列表,例如类/ID 名称。
这是我的代码:
JQUERY:
jQuery(document).ready(function(){
//if this is not the first tab, hide it
jQuery(".imgs:not(:first)").hide();
//to fix u know who
jQuery(".imgs:first").show();
//when we click one of the tabs
jQuery(".img_selection a").click(function(){
//get the ID of the element we need to show
stringref = jQuery(this).attr("href").split('#')[1];
// adjust css on tabs to show active tab
$('.img_selection a').removeAttr('id'); // remove all ids
$(this).attr('id', this.className + "_on") // create class+_on as this id.
//hide the tabs that doesn't match the ID
jQuery('.imgs:not(#'+stringref+')').hide();
//fix
if (jQuery.browser.msie && jQuery.browser.version.substr(0,3) == "6.0") {
jQuery('.imgs#' + stringref).show();
} else
//display our tab fading it in
jQuery('.imgs#' + stringref).show();
//stay with me
return false;
});
});
【问题讨论】:
-
我完全不明白你的问题是什么......如果你想自动调用它,只需在文档准备好或使用 setTimeout 时调用它?
-
我对这一切都是新手,所以我不太确定该怎么做,还有洞察力吗?我很想得到帮助!
标签: jquery automation jquery-animate slideshow