手机版 | ------------全站资源有,统一解压码,解码平台,请点这里 ------------ 设首页 | 加收藏
当前位置: 网站首页 > jQuery库 > 文章 当前位置: jQ > 文章

基于bootstrap的jquery弹出层确认框插件

时间:2020-07-01    点击: 次    来源:网络    作者:佚名 - 小 + 大

基于bootstrap的jquery弹出层确认框插件
简要教程

PopConfirm是一款基于bootstrap的jquery弹出层确认框插件。该jquery弹出层确认框插件兼容bootstrap2和bootstrap3。它能够使用bootstrap Popover来替代确认框功能,非常方便。

使用方法

在页面中引入jquery和bootstrap相关文件,以及jquery.popconfirm.js文件。。

<link rel="stylesheet" href="css/bootstrap.min.css"><script src="js/jquery.min.js"></script><script src="js/bootstrap.min.js"></script>                  <script src="js/jquery.popconfirm.js"></script>                                  
HTML结构

在使用时,例如你想当用户点击一个超链接时,显示一个确认框,当用户点击确定按钮时,才去执行超链接的跳转。

<a href="www.demo.com" id="link">link</a>                
初始化插件

作为jquery插件来使用,通过popConfirm()方法来初始化该jquery弹出层确认框插件。

$("#link").popConfirm();                

在例如有一个按钮:

<button class="btn btn-success" data-toggle='confirmation' id="button">按钮</button>                

点击按钮时,先弹出一个弹出层确认框,单用户点击确定按钮之后,才弹出点击按钮之后触发的消息框。

$('#button').click(function() {    alert('You clicked, and valided this button !');});$("#button").popConfirm();                

配置参数

该jquery弹出层确认框插件的可用配置参数如下:

$("[data-toggle='confirmation']").popConfirm({        title: "Really ?", // The title of the confirm        content: "I have warned you !", // The message of the confirm        placement: "bottom", // The placement of the confirm (Top, Right, Bottom, Left)        container: "body", // The html container        yesBtn: "Yeah",        noBtn: "Oh no !!!"});                              

你也可以通过data-confirm-*属性来直接设置参数。

<a href="destination.html" data-confirm-title="My Super Title" data-confirm-content="My Super Question">Link</a>                

该jquery弹出层确认框插件的github地址为:https://github.com/Ifnot/PopConfirm

 基于bootstrap的jquery弹出层确认框插件 本地下载

上一篇:以Glitch闪烁为过渡动画效果的js轮播图特效

下一篇:支持移动手机的jquery放大镜插件enlarge.js

浙ICP备18035339号-15  |   QQ:79720816  |  地址:蚂蚁分享-一个只做有用的分享。  |  13388629007  |  
Copyright © 2023 蚂蚁分享网 版权所有,授权www.tanan.net使用 Powered by ANTQQ.COM