
內容簡介
使用 Typed.js 外掛程式,輕鬆地創建一個動畫打字效果。
只需安裝和啟用 Animated Typed JS Shortcode 外掛程式即可,透過 [typedjs][/typedjs] 短碼,即可創建您的動畫打字內容。
無需任何設置,即可立即使用。
如何使用短碼?
短碼可使用方式如下:
[typedjs]我的動畫打字內容[/typedjs]
若要顯示多個字串/文字,請使用 double colons (::) 區隔,例如:
[typedjs]我的動畫打字內容::真的很棒![/typedjs]
若要自訂動畫文字行為,可使用短碼屬性進行設定,例如:
[typedjs loop=true]我的動畫打字內容::真的很棒!::現在正在循環,太厲害了![/typedjs]
以下列出所有可用的屬性清單:
typespeed:文字打字速度,以毫秒為單位(預設值:50)
startdelay:開始打字前的延遲時間,以毫秒為單位(預設值:500)
backspeed:回刪速度,以毫秒為單位(預設值:50)
backdelay:回刪前的等待時間,以毫秒為單位(預設值:500)
smartbackspace:僅回刪與之前字串不匹配的字元(預設值:true)
shuffle:重新排列字串(預設值:false)
fadeout:淡出動畫,而非回刪(預設值:false)
fadeoutdelay:淡出前的等待時間,以毫秒為單位(預設值:500)
loop:循環成員動畫(預設值:false)
loopcount:循環次數,如果啟用(預設值:Infinity)
showcursor:顯示/隱藏游標(預設值:true)
cursorchar:要作為游標選用的字元符號(預設值:|)
致謝
感謝 Matt Boldt 創建這個酷炫的程式庫 Typed.js!
外掛標籤
開發者團隊
原文外掛簡介
Create an animated typing effect with Typed.js easily.
Just install and activate, Animated Typed JS Shortcode plugin and you can start using [typedjs][/typedjs] shortcode to create your animated typing text.
No settings needed just plug and play.
How to use the shortcode?
You can use the shortcode just like this:
[typedjs]My animated typing text[/typedjs]
To show more than 1 string/text, separate the strings with a double colons (::) like this:
[typedjs]My animated typing text::It's freaking awesome![/typedjs]
If you want to customize your animated text behaviour, you can use shortcode attributes to do that like this:
[typedjs loop=true]My animated typing text::It's freaking awesome!::It's now looping, OMG![/typedjs]
Here are the list of all available attributes that you can use:
typespeed : The text typing speed in milliseconds (default: 50)
startdelay : Delay time before typing start in milliseconds (default: 500)
backspeed : Backspacing speed in milliseconds (default: 50)
backdelay : Time before backspacing in milliseconds (default: 500)
smartbackspace : Only backspace what doesn’t match the previous string (default: true)
shuffle : Shuffle the strings (default: false)
fadeout : Fade out instead of backspace (default: false)
fadeoutdelay : Time before fade out in milliseconds (default: 500)
loop : Loop strings animation (default: false)
loopcount : Amount of loops if enabled (default: Infinity)
showcursor : Show/hide cursor (default: true)
cursorchar : Character to be used as cursor (default: |)
class: Custom class for the shortcode element (default: ”)
Optimize Javascript loading
The typed.min.js is only 12KB, in the previous version I tried to load the script only when the shortcode is used, but it’s not working properly because the script is loaded asynchronously. So, I decided to load the script in the footer of the page to make sure it’s loaded properly.
However, if you want to load the script only on specific pages, you can use this hook to enqueue the script only on specific pages:
`php
add_action(‘wp_enqueue_scripts’, ‘my_custom_typedjs_script’);
function my_custom_typedjs_script() {
if ( ! is_page( ‘my-page-slug’ ) ) {
wp_dequeue_script( ‘typedjsshortcode’ );
}
}
`
This will dequeue the script on all pages except the page with the slug my-page-slug.
CREDITS
Thanks to Matt Boldt for creating this cool library Typed.js!
