0
我想通過JavaScript添加scrollTop
動畫。它在Mozilla中正常工作,但在Chrome中完全沒有問題。點擊Chrome中的鏈接不會執行任何操作。scrollTop適用於Mozilla,但不適用於Chrome
這裏是我的代碼:
<script type="text/javascript">
$(document).ready(function() {
$('a[href=#smart_tshirt]').click(function(){
$('html, body').animate({scrollTop:1400}, 'slow');
});
$('a[href=#smart_tshirt2]').click(function(){
$('html, body').animate({scrollTop:1400}, 'slow');
});
return false;
});
</script>
<div style="top: 0px; left: 140px; font-size: 32px; text-align: left; width: 100%;
height: 47px; font-family: 'League Gothic'; color: rgb(102, 102, 102); line-height:
25px; float: left;"><a href="#smart_tshirt" id="#smart_tshirt">Smart<br />
T-shirt</a></div>
<div style="top: 80px; left: 140px; font-size: 14px; text-align: left; height: 100px;
font-family: 'Carrois Gothic',sans-serif; color: rgb(102, 102, 102); line-height: 19px;
width: 130px; float: left;">With integrated cardiac sensors.</div>
<div style="top: 29px; left: 260px; width: 19px; height: 19px; float: left;"><a
href="#smart_tshirt2" id="#smart_tshirt2"><img alt="smart t-shirt"
src="images/universo/flechaNar.jpg" /></a></div>
</div>
非常感謝,讓我試試看 –
@DrManhattan如果仍然沒有工作,請準備上[的jsfiddle]爲例(http://jsfiddle.net/)爲我們編輯你的問題。 – morkro
這裏是小提琴: - > [鏈接到小提琴](http://jsfiddle.net/3mPfc/) –