Bootstrap 文件上传插件Filestyle的用法

Suport IE 8+

The Bootstrap Filestyle is a plugin for jquery-based component library could Twitter Bootstrap, used to style the file fields of the forms.

This plugin has an interesting way to present a form for sending files so attractive, while being simple and efficient.

Twitter Bootstrap and jQuery.

Include:

<script type="text/javascript" src="js/bootstrap-filestyle.min.js"> </script>

Via JavaScript:

$(":file").filestyle();

Via data attributes:

<input type="file" class="filestyle">

input

- Enables or disables the input text. Type: Boolean, Default: true

Via JavaScript:

$(":file").filestyle({input: false});

Via data attributes:

<input type="file" class="filestyle" data-input="false">

Example:

icon

- Enables or disables the button icon. Type: Boolean, Default: true

Via JavaScript:

$(":file").filestyle({icon: false});

Via data attributes:

<input type="file" class="filestyle" data-icon="false">

Example:

buttonText

- Changes the button text. Type: String, Default: "Choose file"

Via JavaScript:

$(":file").filestyle({buttonText: "Find file"});

Via data attributes:

<input type="file" class="filestyle" data-buttonText="Find file">

Example:

buttonName

- Change classes bootstrap button. Type: String, Default: "btn-default"

Via JavaScript:

$(":file").filestyle({buttonName: "btn-primary"});

Via data attributes:

<input type="file" class="filestyle" data-buttonName="btn-primary">

Example:

size

- Change size bootstrap of the button and input. Type: String, Default: "nr"

Accepted values: lg, nr, sm

Via JavaScript:

$(":file").filestyle({size: "sm"});

Via data attributes:

<input type="file" class="filestyle" data-size="sm">

Example:

iconName

- Change classes bootstrap icons. Type: String, Default: "glyphicon-folder-open"

Via JavaScript:

$(":file").filestyle({iconName: "glyphicon-inbox"});

Via data attributes:

<input type="file" class="filestyle" data-iconName="glyphicon-inbox">

Example:

disabled

- Disabled button. Type: Bool, Default: false

Via JavaScript:

$(":file").filestyle({disabled: true});

Via data attributes:

<input type="file" class="filestyle" data-disabled="true">

Example:

buttonBefore

- Button before. Type: Bool, Default: false

Via JavaScript:

$(":file").filestyle({buttonBefore: true});

Via data attributes:

<input type="file" class="filestyle" data-buttonBefore="true">

Example:

badge

- Enables or disables the badge counter. Type: Boolean, Default: true

Via JavaScript:

$(":file").filestyle({badge: false});

Via data attributes:

<input type="file" class="filestyle" data-badge="false">

Example:

clear

- Clear selected files.
$(":file").filestyle('clear');

destroy

- Destroy a filestyle completely.
$(":file").filestyle('destroy');

disabled

- Disabled a filestyle.
// get
$(":file").filestyle('disabled');
// set
$(":file").filestyle('disabled', true);

input

- Set or get the value of the input option.
// get
$(":file").filestyle('input');
// set
$(":file").filestyle('input', false);

icon

- Set or get the value of the icon option.
// get
$(":file").filestyle('icon');
// set
$(":file").filestyle('icon', false);

buttonText

- Set or get the text of the button.
// get
$(":file").filestyle('buttonText');
// set
$(":file").filestyle('buttonText', 'Loading...');

buttonName

- Set or get the class of the button.
// get
$(":file").filestyle('buttonName');
// set
$(":file").filestyle('buttonName', 'btn-danger'};

iconName

- Set or get the class of the icon.
// get
$(":file").filestyle('iconName');
// set
$(":file").filestyle('iconName', 'glyphicon-home');

size

- Set or get the class of the input text.
// get
$(":file").filestyle('size');
// set
$(":file").filestyle('size', 'lg');

buttonBefore

- Set or get button position.
// get
$(":file").filestyle('buttonBefore');
// set

$(":file").filestyle('buttonBefore', 'true');

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值