1

正如在这个网站上看到的那样我试图复制三个选项卡之间的淡入淡出过渡,当每个选项卡都被单击时。我不知道我是遗漏了什么还是我只是个白痴,但我似乎无法在源代码中找到代码来制作隐藏/可见事件。

如果有人可以向我指出,或者建议一个简单的替代方案,我将不胜感激。

提前致谢。

4

2 回答 2

0

查找jQuery Fade In函数和淡出,很容易复制这样的东西。

须藤代码:

link.onClick{
 $('#lastDiv').fadeOut('slow')
 $('#newDiv').fadeIn('slow')
}
于 2012-09-15T17:22:24.150 回答
0

它实际上是通过 jQuery 完成的:

$(".content").each(function() {
    var container = this
    var tabbodies = $(this).find(".tabbody")
    var tabs = $(this).find(".tab")
    if (!isMobile) tabs = tabs.not(".news .tab")
    tabs.click(function(e) {
    e.preventDefault()
    var self = this
    var body = this.hash ? $(this.hash) : $(this).next(".tabbody")
    tabs.not(this).removeClass("current")
    $(this)[isMobile ? "toggleClass": "addClass"]("current")
    tabbodies.not(body).stop(true, true)[isMobile ? "slideUp" : "hide"]()
    body.stop(true, true)[isMobile ? "slideToggle" : "fadeIn"]()
    if (isMobile) $.scrollTo(container, 500, {offset: {top: -45}})
}) 

使用 Firebug,您可以在第 245 行的 script.js 中看到它。

于 2012-09-15T17:26:22.563 回答