0
我希望能夠使用jQuery控制按鈕的按鈕行爲。使用jquery控制按鈕行爲使用按鈕
例如,我創建了以下按鈕,當我點擊他們每個人:
1) Start (class=btnStart) => the marquee starts
2) Stop (class=btnStop) => the marquee stops
3) Back (class=btnBack) => the marquee move backward
4) Right (class=btnRight) => the marquee moves to right
5) Fast (class=btnFast) => the marquee moves faster
6) Slow (class=btnSlow) => the marquee moves slower
<body>
<div>
<marquee>Lots of contents here, scrolling right to left by default</marquee>
</div>
<div>
<button class="btnStart">Start</button>
<button class="btnStop">Stop</button>\
</div>
<script>
$(function(){
$(".btnStop").click(function(){
$("marquee").stop();// it does not work
});
$(".btnFast").click(function(){
$("marquee").attr("scrollamount","5"); // doesnt change speed
});
});
</script>
</body>
請告訴我們你已經嘗試了什麼。 –
我剛剛加了我到目前爲止所嘗試過的。說實話,我不知道我在做什麼。 –