css带占位符的搜索框,superplaceholder.js-功能强大的超级输入框占位符插件

superplaceholder.js是一款带演示功能的超级输入框占位符JavaScript插件。superplaceholder.js可以让占位文本动起来,它能够周期性的循环显示预定义的文本字符串,增强提示功能,提升用户体验。

ec4cd05038d02d7d927afb11fd939a12.gif

安装

可以通过bower或npm来安装superplaceholder.js插件。

bower install superplaceholder

npm install superplaceholder

使用方法

使用该插件需要在页面中引入superplaceholder.js文件。

初始化插件

使用superplaceholder.js插件的基本语法格式为:

superplaceholder({

el: ,

sentences: ,

options: {} // 可选的自定义参数

});

例如:

superplaceholder({

el: document.querySelector('input'),

sentences: [ '要显示的占位文本', '其它一些文本信息']

});

配置参数

superplaceholder({

el: document.querySelector('input'),

sentences: [ 'Something to show', 'Another thing to show'],

options: {

// delay between letters (in milliseconds)

letterDelay: 100, // milliseconds

// delay between sentences (in milliseconds)

sentenceDelay: 1000,

// should start on input focus. Set false to autostart

startOnFocus: true,

// loop through passed sentences

loop: false,

// Initially shuffle the passed sentences

shuffle: false,

// Show cursor or not. Shows by default

showCursor: true,

// String to show as cursor

cursor: '|'

}

});

letterDelay:各个字符显示之间的延迟时间,单位毫秒。

sentenceDelay:各个句子之间的延迟时间,单位毫秒。

startOnFocus:在输入框聚焦时才开始播放,设置为false会自动开始播放。

loop:是否循环播放。

shuffle:是否打乱传入的句子。

showCursor:是否显示光标,默认为显示。

cursor:光标字符串。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值