Git Product home page Git Product logo

bootstrap-file-input's Introduction

为bootstrap提供统一的文件上传按钮

试用了几个类似的,不能满足需求,干脆自己写一个。
思路是:利用label完成辅助点击file框,并把file框设置为透明即可,非常简单
可完美解决在ie中的“访问限制”问题(即必须是用户点击才能进行文件上传),且无位置偏移问题。

使用方式

导入js和css即可,会自动查找file标签执行初始化

<script src="./js/bootstrap.file-input.js"></script>
<link href="./css/bootstrap.file-input.css" rel="stylesheet">

效果

Test XIB

其他参考:

1、http://gregpike.net/demos/bootstrap-file-input/demo.html
缺点:ie8(其他版本未测试)下,可能在使用过程中input位置有偏差
2、http://addyosmani.github.com/jquery-ui-bootstrap/extra.html#file-input
这个是jquery-ui-bootstrap的参考示例,缺点也是ie的限制

所以大家可以根据我的思路改写这两个。

bootstrap-file-input's People

Contributors

zhangkaitao avatar navee avatar

Watchers

张伟 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.