嗨,有人可以幫助我改變這種編碼我試圖刪除href頁面#.html加載並使用預加載li與文本來填充單擊鏈接時的sclit div。更改jQuery加載代碼
<div id="sclit"></div>
<!-- old code
<a href="page1.html" class="para">Sci Lit 1</a>
<a href="page2.html" class="para">Sci Lit 2</a>
<a href="page3.html" class="para">Sci Lit 3</a>
-->
<ul style="display:none">
<li class="page1"> text text </li>
<li class="page2"> text text </li>
<li class="page3"> text text </li>
</ul>
<script>
jQuery(document).ready(function() {
jQuery(".para").click(function() {
// jQuery("#sclit").load(jQuery(this).attr('href')); // old code
jQuery("#sclit").load(jQuery(this).attr('li'));
});
});
</script>
您是否試圖將每個錨中的href頁面預加載到'li'中,然後在單擊'a'時將它們交換出來? – hunter 2011-05-23 14:45:12