webui-popover 一个轻量级的jquery弹出层插件

2017-06-20  本文已影响2218人  蝴蝶结199007

该提示框插件可以和Bootstrap完美结合,但是并不一定需要和Bootstrap一起使用。它支持IE7以上的浏览器。

引用:

<link rel="stylesheet" href="jquery.webui-popover.css">
...
<script src="jquery.js"></script>
<script src="jquery.webui-popover.js"></script>

使用:

$('a').webuiPopover(options);

简单的弹出菜单:

$('a').webuiPopover({title:'Title',content:'Content'});

在DOM中使用 data-* 属性创建弹出层:

<a href="#" data-title="Title" data-content="Contents..." data-placement="right">show pop</a>
$('a').webuiPopover();

或者设置一个div层,添加类名 webui-popover-content

<a href="#" >shop pop</a>
<div class="webui-popover-content">
   <p>popover content</p>
</div>
$('a').webuiPopover();

参数:

{
    placement:'auto',//值: auto,top,right,bottom,left,top-right,top-left,bottom-right,bottom-left
    width:'auto',//可以设置数字
    height:'auto',//可以设置数字
    trigger:'click',//值:click,hover
    style:'',//值:'',inverse
    delay:300,//延迟时间, 悬浮属性才执行
    cache:true,//如果缓存设置为false,将重建
    multi:false,//在页面允许其他弹出层
    arrow:true,//是否显示箭头
    title:'',//标题,如果标题设置为空字符串时,标题栏会自动隐藏
    content:'',//内容,内容可以是函数
    closeable:false,//显示关闭按钮
    padding:true,//内容填充
    type:'html',//内容类型, 值:'html','iframe','async'
    url:''//如果不是空的,插件将通过url加载内容
}

Tips:需要使用jquery1.7+版本
github地址

上一篇 下一篇

猜你喜欢

热点阅读