BootStrap文件上传样式超好看【持续更新】文件上传样式超好看【持续更新】
主要介绍了BootStrap文件上传样式非常好看,通过引入相关插件,实现此效果,非常具有参考借鉴价值,感兴趣的朋友快来一起学习吧
一一 直接使用直接使用bootstrap,利用简单的,利用简单的js控制控制
http://duckranger.com/2012/06/pretty-file-input-field-in-bootstrap/
非常简单,代码如下:
<input id="lefile" type="file" style="display:none">
<div class="input-append">
<input id="photoCover" class="input-large" type="text" style="height:30px;">
<a class="btn" onclick="$('input[id=lefile]').click();">Browse</a>
</div>
<script type="text/javascript">
$('input[id=lefile]').change(function() {
$('#photoCover').val($(this).val());
});
</script>
效果如下:
不需要任何其他的js和css,只需要引入bootstrap和jQuery即可
其实这个就是拼接出来的,然后js控制显示文件名。
效果如下:
二二 bootstrap-filestyle
http://markusslima.github.io/bootstrap-filestyle/
注意:此样式只能使用bootstrap2的css,版本为bootstrap3的css是不兼容的!!(妈蛋我就因为这个测试了老半天。。摔
效果如下:
三三 bootstrap-file-input
http://www.gregpike.net/demos/bootstrap-file-input/demo.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>bootstrap.file-input</title>
<link href="css/bootstrap.min.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/bootstrap.file-input.js"></script>
</head>
<body>
<!-- Change the wording using a title tag -->
<input type="file" title="Search for a file to add 1" class="btn-primary">
<br>
<br>
<input type="file" title="Search for a file to add 2" class="btn btn-primary">
<br>
<br>
<input type="file" title="Search for a file to add 3" class="btn-primary">
<br>
<br>
<input type="file" title="Search for a file to add 4" class="btn-primary">
<br>
<br>
<br>
<br>
<br>
Disable the styling:
<!-- Disable the styling -->
评论0