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 🙏

© 2026 – Pkg Stats / Ryan Hefner

free-popup

v1.2.4

Published

一个自由冒泡,可以做提示,内容弹出等

Readme

Popup


该组件基于webpack(commonjs)+jquery

使用方法

npm install free-popup --save

let popup = require('free-popup');

//基本用法
let _popup = new popup({
    trigger:'.ele',
    triggerType:'click',
    content:'test'
    ...
});

详细的参数列表


trigger

触发对象(必填): jquery 对象(string)

triggerType

触发方式 (选填): 默认为 click 可选项如下:

  • click
  • hover
  • 一切可能有的触发事件

direction

冒泡框出现的方向(选填): 默认为 bottom 可选项如下

  • top
  • right
  • bottom
  • left

position

冒泡框的位置定位,做微调 (选填): Array 默认为[0,0] [X,Y] 其中X表示X轴,Y表示Y轴

目前不接受百分比传参

pointer

冒泡框的指针的位置定位,做微调 (选填): Array 默认为[0,0] [X,Y] 其中X表示X轴,Y表示Y轴

width

冒泡框的宽度 接受 百分比 | string | number (px)

百分比 相对父元素

height

冒泡框的高度 接受 百分比 | string | number (px)

百分比 相对父元素

fixed

冒泡框定位方式是是否为绝对定位,为 true 的时候为 绝对定位

参数:boolean

style

修改冒泡框本身的样式

参数:object

//例如
style:{
    'background':'red'
}

pointerStyle

修改冒泡框 指针 本身的样式 参数:object

//例如
style:{
    'background':'red'
}

content

冒泡框内容,接受任意HTML

内容为空的时候,冒泡框不会显示

pointerHide

是否隐藏 指针 为 true 的时候隐藏

参数:boolean

autoClose

开启当前冒泡框的时候自动隐藏其他冒泡框,默认为true

参数:boolean

false的时候,不会自动隐藏本身

autoInitContent

参数:boolean

每次触发冒泡框显示的时候都会重新渲染冒泡框本身的内容,不重新传false

forceNoClose

参数:boolean

强制不自动关闭 popup 默认为 false


回调函数

show(str)

显示冒泡框

参数:str(string选填)内容会直接替换content内容

hide()

隐藏冒泡框

showBefore(cb)

显示冒泡框之前,触发cb回调

参数:cb(function选填)

showAfter(cb)

显示冒泡框之后,触发cb回调

参数:cb(function选填)

hideAfter(cb)

显示冒泡框之后,触发cb回调

参数:cb(function选填)

setContent(cb)

可以改变组件本身的this属性,主要用于this.content。方法和其他function api 大同小异。区别在于,当popup是显示的状态下,会立马响应组件,重新渲染内容