我有一個強調詞的句子。這個強調的單詞將通過向上滑動而消失,並被另一個滑動的單詞取代。我試着使用jQuery(EDGE)和jQuery UI的1.8.9像這樣(see fiddle),但不能讓它運行:使用jQuery/jQuery UI滑動文字
HTML
<p>This is my text
<span>one</span>
<span>two</span>
<span>three</span>
<span>four</span>
<span>five</span>
without fear.</p>
CSS
span {
display: none;
color: red;
}
span:first-child {
display: inline-block;
}
的JavaScript
$(function() {
var first = $('span:first-child');
replaceWord(first);
});
function replaceWord(word) {
var next = word.next();
if (typeof(next) != "undefined") {
first.hide("slide", {
direction: "up"
}, 500, function() {
next.show("slide", {
direction: "down"
}, 1000);
replaceWord(next);
});
}
}
想知道我在找什麼:我設法得到了這個效果,但沒有打電話給fu nction遞歸地和jQuery 1.9.1/jQuery UI 1.9.2 on this fiddle。這有一個CSS錯誤,所以它適用於display: block
而動畫。
任何想法?
我一直在玩的答案,認爲這可能有助於在這裏http://jsfiddle.net/apcwonn7/張貼3/ – Cobote
@ jt000你的小提琴示例不起作用。點擊按鈕不會做任何事情。 –
@ jt000您需要將URL更改爲HTTP而非HTTPS才能使其正常工作。 – Cobote