0
jQuery UI演示网页上的中间路径here打开和关闭源代码窗口的“查看源代码”链接的源代码是什么?在jQuery UI的演示网页上,“查看源代码”链接的源代码是什么?
jQuery UI演示网页上的中间路径here打开和关闭源代码窗口的“查看源代码”链接的源代码是什么?在jQuery UI的演示网页上,“查看源代码”链接的源代码是什么?
这只是他们的脚本功能,隐藏和显示源DIV:
if ($('#demo-source').length == 0) {
$('<div id="demo-source"><a href="#" class="source-closed">View Source</a><div><pre><code></code></pre></div></div>').insertAfter('#demo-notes');
$('#demo-source').find("> a").click(function() {
$(this).toggleClass("source-closed").toggleClass("source-open").next().toggle();
return false;
}).end().find("> div").hide();
}
$('#demo-source code').empty().text(source);
You can view the full script here时,它将通过AJAX(代码当前页面的$.get()
,或者当你点击一个演示链接右边抓住一个),将其格式化以供显示,然后将其传递给该函数,以在页面中的正确位置处插入“查看源”div /链接。