對不起..我跑了幾十個問題是這樣,但他們都不似乎幫了我:(防止HREF =#與jQuery跳轉到頂部
我使用切換腳本,但我每次都!?點擊腳本的鏈接它切換,但它也跳轉到頁面頂部的任何想法這裏是代碼:
<a href="" id="button2">Read More…<a>
<div id="hidden_content2" style="display:none;">
<p>bla bla</p>
</style>
</div>
<script>
$(document).ready(function() {
$("#button2").toggle(
function() {
$(this).text('Hide Content…');
},
function() {
$(this).text('Read More…');
}
).click(
function() {
$("#hidden_content2").slideToggle("slow"…
}
);
});
</script>
哎呀!呸... !!! – 2013-03-07 12:25:18
?什麼 !!!!!!!!!!!!!!! – supersaiyan 2013-03-07 12:30:30
閱讀http://stackoverflow.com/a/2479904/560648和http://stackoverflow.com/questions/134845/href-attribute-for-javascript-links-or-javascriptvoid0(忽略頂級答案,因爲它是錯誤的)。 – 2013-03-07 12:31:52