【问题标题】:Text and image slider文本和图像滑块
【发布时间】:2016-10-20 22:19:19
【问题描述】:

我找到了这个http://fiddle.jshell.net/KFmLv/5750/

我想使用 prev 和 next 按钮直接从 json 文件加载内容(图像和文本)。

我该怎么做?

【问题讨论】:

  • 您的 JsFiddle 中没有图像。你目前有什么尝试?

标签: javascript jquery html css json


【解决方案1】:

要加载 json,请使用 getJSON 方法,例如

$.getJSON("data.json", function(data) { doSomething(); } )

我不确定你想要达到什么样的效果,但也许会是这样的

$("#next").click(function() {
    $("#img").src = images[++current];
    $("#info").text( texts[current] );
})

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-10-27
    • 1970-01-01
    • 1970-01-01
    • 2022-01-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多