npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jqselector

v1.1.0

Published

### 简介

Downloads

8

Readme

jQselector.js Build Status

简介

jQselector.js是一款简单的下拉框插件。
支持单选,多选,本地搜索,远程(ajax)搜索,自定义主题。

快速开始

安装

1、引用文件的方式: 从/dist/prod/ 中 拷贝 jq-selector.js 文件至你的目录。

<script src='/your_path/jq-selector.js'></script> 

2、也可以使用npm

npm install jqselector

3、同样支持模块化

require ('jqselector');
HTML结构
    
<div class='mySelectorContainer'>
    <!-- 这个div是容器,之后初始化的插件将会以这个容器的位置和尺寸进行适配,所以你可以给这个容器一个你喜欢的大小。jQselector会自动适应 -->
   <select name='perople' class='mySelector' multiple="multiple" >
   <!-- 如果你想使用多选功能,请给select添加multiple属性 -->
       <option></option>
   </select>   
</div>
     
初始化
    $('.mySelector').jQselector();

可选的配置项

    jQselectorOptions =  {
        search:true,//boolean,是否启用搜索功能
        allowClose:true,//是否显示删除按钮,默认显示
        onChange:function(selectedData){ //function,当选中数据发生改变时的回调函数
        console.log(selectedData) 
        },
        remote:{//启用ajax搜索
	  	url:'api.mydomain.com',//请求的地址
	  	format:function(responseData){//响应数据的格式化处理,必须有返回值
	  	    //这里你应该将响应的数据处理成
	  	    //[{value:'xiaoming',text:'小明'}]
	  	    //的格式
	  	    //value是option的值,text是option的展示文本
	  		return responseData; //将处理后的数据返回给jQselector
	  		//如果你省略了这个函数,jQselector会直接使用响应的数据
          },
          delay:300 //输入延迟搜索,默认300ms
	  },
        colors:{
            //自定义主题色
            //这里的属性的值得格式为字符串
            //支持标准css属性
            //如 '#e6e6e6','RGBA(255,255,255,.5)','red'...
            front:'#333',//前景色,默认'#333'
            background:'#fff',//背景色,默认'#fff'
            selectedFront:'#000',//选中前景色,默认'#000'
            selectedBackground:'#e6e6e6'//选中背景色,默认'#e6e6e6'
        }
    };