我想使它每當你點擊標題它加快。然而,它要麼加速前幾次點擊或開始變得非常緩慢。我也嘗試將* = 999的符號更改爲+ =和 - =,並且我沒有發現任何不同的結果。請幫忙。如何使標題加快每點擊使用jquery和javascript
var x = 10000
//x is the speed of animate
//this is where the movement is defined for the heading
function move() {
$("h1").animate({
"left": "+=200px"
}, x).animate({
"top": "+=200px"
}, x).animate({
"left": "-=200px"
}, x).animate({
"top": "-=200px"
}, x);
}
//this should make the heading move faster
$("h1").click(function() {
move()
//this should make it move faster
x *= 999
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<h1 id="heading" style="position:absolute;">Watch the moving heading!</h1>
你有適用於任何頭CSS?我們也可以看到嗎? – Lewis
爲什麼CSS會相關? –
我想知道,例如,如果頭已絕對定位與已定義的/最高值。 – Lewis