2
好吧,我一直在努力研究如何做到這一點,並失敗了。我認爲這可能與JQuery的replaceWith但不知道如何實現它。用jquery onClick更改多個元素如何?
基本上我有這些圖標導航:
<li><a href="#navclose" class="open"><span>MAINSTREAM</span><img src="images/stacks/mainstream.png" alt="MAINSTREAM" /></a></li>
<li><a href=""><span>THOUGHT MENU</span><img src="images/stacks/thoughtmenu.png" alt="THOUGHTMENU" /></a></li>
<li><a href="#"><span>Redrawing the Maps</span><img src="images/stacks/redrawnmaps.png" alt="Photoshop" /></a></li>
當每個圖標點擊我要它改變信息(加載網頁到主iframe中的內容),項目我想改變的是URL 'http://www.redrawingthemaps.org.uk/' 和日期信息 '發起的2012年6月' 在這裏:
<div id="navclose">
<div id="navfunction" >
<div id="searchbar"><ul class="navfunction2">
<li>http://www.redrawingthemaps.org.uk/</li>
</ul></div>
<ul class="navfunction">
<li style="margin-right:-2px;"><a href="#navclose" class="close">Close</a></li>
<li><a href="http://www.redrawingthemaps.org.uk/" target="_blank">Open In New Window</a> </li>
<li>Initiated June 2012</li>
</ul>
</div>
<div id="navcontent"><iframe src="http://www.redrawingthemaps.org.uk/" width="1000px" height="3000px" frameborder="0"></iframe></div>
</div>
<script>
$(function() {
$('a.open').click(function() {
$($(this).attr('href')).slideDown(500);
return true;
});
$(function() {
$('a.close').click(function() {
$($(this).attr('href')).slideUp(500);
return false;
});});
});});
</script>