当我单击页面上的链接时,我在页面上有多个隐藏的 div,每个都包含不同的内容,例如
<a href="#contentone" class="clicky">Load content one</a>
<a href="#contenttwo" class="clicky">Load content two</a>
<div id="contentone">Some content here to be loaded into another div</div>
<div id="contenttwo">Some content here to be loaded into another div</div>
<div id="slider">
This content to be replaced by content from links/hidden divs
</div>
目前我已经有了这个设置,所以它从外部源加载内容,但我更希望它用隐藏在页面上的内容填充滑块(如上)。
我当前的 jquery 在下面,希望将其转换为在页面上的隐藏 div 中工作,而不是外部文件。
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){
$(function () {
$(".clicky").click(function () {
var url = this.href;
var e = $("#slider");
e.load(url, function() {
e.animate({width: "show"}, 500);
});
return false;
});
});
});//]]>
</script>