基于JQuery封装自定义美化的 select组件

本文档介绍了如何使用JQuery封装一个自定义样式的select组件,并提供了配套的CSS和JS文件。通过这个组件,你可以根据需要调整select组件的样式,以满足个性化需求。同时,还附带了input字段的自定义美化方法。
摘要由CSDN通过智能技术生成

浏览器自带的select组件样式太丑,有时候想要一款自己满意的组件,不满意样式还可以自行修改;
组件封装不是得多完美,适用才是最好的;

select组件配套的CSS

/* UI组件样式 */
/* select */
.stui_select {
   width: 100%;position: absolute;top: 0;left: 0;z-index: 10;}
.stui_select h3 {
   line-height: 32px;}
.stui_select dl{
   border: 1px solid #eee;height: 32px;color: #666;position: relative;}
.stui_select dl .span_list {
   max-height: 240px;overflow-y: auto;text-align: left;}
.stui_select dt {
   padding-left: 13px;line-height: 32px;height: 32px;cursor: pointer;}
.stui_select dt .input {
   width: 90%;height: 32px;line-height: 32px;color: #666;border: none;overflow: hidden;text-align: left;}
.stui_select dt p.input {
   font-weight: 500;}
.stui_select dt span{
   border: 5px solid;border-right-color: transparent;border-left-color: transparent;right: 6px;}
.stui_select dt.down span {
   border-top-color: #999;border-bottom-color: transparent;top: 11px;}
.stui_select dt.up span {
   border-bottom-color: #999;border-top-color: transparent;top: 4px;}
.stui_select dd {
   width: 100%;background: #fff;border: 1px solid #eee;margin-top: 0;margin-left: -1px;position: absolute;left: 0;}
.stui_select dd.top {
   bottom: 34px;}
.stui_select dd span {
   transition: all .3s;display: block;height: 32px;line-height: 32px;padding-left: 13px;cursor: pointer;overflow: hidden;}
.stui_select dd span.st_active {
   color: #FFAE00;}
.stui_select dd span:hover {
   background: #ffae00;transition: all .3s;color: #fff!important;}
.stui_select .search {
   padding: 5px 13px;}
.stui_select .search input {
   width: 100% !important;height: 32px;line-height: 32px;padding-left: 10px;}

select 组件js

/* select */
(function($){
   
    $.fn.stSelect = function(options){
   
        //对象混入---mix---$.extend
        return this
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值