Giter Site home page Giter Site logo

benqy / beautyselect Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 396 KB

项目中需要自定义下拉框,于是写了个简易的下拉框美化控件,只有几十行,样式可在css中自定义。

Home Page: http://benqy.github.io/BeautySelect/

CSS 9.78% JavaScript 90.22%

beautyselect's Introduction

#BeautySelect

version 0.1

这几天在项目中需要用到自定义的下拉框,开源的现在有好多个,并且很好用了,比如这个chosen。 但是这些插件虽然功能强大,对项目来说却太庞大了,里面大部分功能都用不到,于是就抽空写了个简单的下拉框美化控件BeautySelect。

目前才刚开始写,功能非常简单,代码也很少,在ie6,7,8,chrome,firefox上测试过了,单元测试截图在最下面。 特点:小巧,接下来的其他功能和接口将写在扩展的脚本里,样式全部在BeautySelect.css中,可自定义(除了宽度,宽度取select控件的宽度)。

使用示例(demo):

调用插件:

var beauty = $('#s1').beautySelect({
	onChange: function (e, data) {
		alert(data);
	}
});

取当前值(beauty为前面调用插件时的返回值) :

beauty['s1'].val();

设置值 :

beauty['s1'].val(1);

添加项:

beauty['s1'].addOption('选项5', 5);

###测试截图(Qunit): 图片1 图片2

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.