ä»ãããªãã§ããªãã¡ã½ããã§ããã©ããã£ããä½ã£ãã®ã§è¨äºæ¸ãã¦ããã¾ãã対象è¦ç´ å
ã®ããã¹ããä¸æåãã¤è¡¨ç¤ºããã ãã§ãã
ãã¹ã / ãã¦ã³ãã¼ã
使ãæ¹
ãã®ã¾ã¾ã¤ãã
æåã« $.typewrite(jQueryãªãã¸ã§ã¯ã) ã§åæåãã¦ããã¾ãããã¨ã¯ä»»æã®ã¿ã¤ãã³ã°ã§ .play() ã¡ã½ããã§ã¨ãã§ã¯ããå®è¡ã§ãã¾ãã
.play(4) ã®ããã«å®è¡æã« duration ã決ãããã¨ãã§ãã¾ãã
.play() ã¡ã½ãã㯠jQuery Deferred ãªãã¸ã§ã¯ããè¿ãã®ã§ãå®äºæã«ä½ããããã¨ã㯠.done() ã§ã¤ãªãã°OKã§ãã
JavaScript
var typewrite1 = $.typewrite($('#typewrite1'));
$('#do_typewrite1').click(function() {
typewrite1.play();
});
HTML
This is typewrite
ãªãã·ã§ã³ã¨Deferredã使ã
JavaScript
var typewrite2 = $.typewrite($('#typewrite2'), {
duration: 2,
hide: false,
end: '|'
});
$('#do_typewrite2').click(function() {
typewrite2.play().done(function() {
alert('completed');
});
});
HTML
This is typewrite
This is typewrite
jQuery ãã©ã°ã¤ã³ã¨ãã¦ä½¿ã
jQuery ãã©ã°ã¤ã³ã¨ãã¦ä½¿ãå ´åã¯ãplay() ã¡ã½ããã typewritePlay() ã¡ã½ããã«å¤ããã¾ãã
var typewrite4 = $('#typewrite4').typewrite({
end: '|'
});
$('#do_typewrite4').click(function() {
typewrite4.typewritePlay(2);
});
ãªãã·ã§ã³
ãªãã·ã§ã³ |
説æ |
duration |
ã¨ãã§ã¯ããå§ã¾ã£ã¦ããçµããã¾ã§ã®æéã1(s)ã®ããã«ç§ã§æå® (def 1 |
hide |
åæåæã«ããã¹ããé ããã©ãã (def true |
end |
å
¥åã«ã¼ã½ã«ãæå®ã§ãã¾ã (def _(underscore) |
wait |
ããã·ã¥ã§å¯¾è±¡ã®æåã¨å¾
ã¡æéã渡ãã¨ãã®æåã®ã¨ãã«ä½åã«å¾
ã¤ï¼æ¬¡ã®é
㸠|
wait
ããã©ã«ãã¯æ¥æ¬èªã®4æåã ãæå®ãã¦ãã®ã§å¤ãã¦ãã ãã
æåå |
å¾
ã¡æé |
ï¼ |
0.1 |
ï¼ |
0.1 |
ã |
0.1 |
ã |
0.1 |
æå®ããã¨ãã¯ãããªæãã§
$.typewrite(hoge, {
wait: {
',': 0.3,
'.': 0.3
}
});
使ãã¨ãã®æ³¨æç¹
対象ã®è¦ç´ ã¯ã
以å¤ã®HTMLè¦ç´ ãå«ããã¨ãã§ããªãã®ã§ããã®è¾ºãããããããããã¾ãã