Modal Dialog Box Plugin Based On jQuery | cxDialog

cxDialog is a jQuery-based dialog plugin that supports custom appearance styles, is Zepto compatible, and is suitable for portable use. This jQuery plugin is used to generate popups in modal style dialog for alert, confirmation, and prompt.

Starting with version 2.0, the jQuery dependency has been removed. If you need to use the old version, you can check the v1 branch.

Must Read: Simple Modal Solution Using Pure JavaScript and CSS | bp-modal.js

How to make use of it:

1. Introducing the browser:

<link rel="stylesheet" href="cxdialog.css">
<script src="cxdialog.js"></script>

2. Install from NPM, imported as a module:

npm install cxdialog
import 'cxdialog.css';
import cxDialog from 'cxdialog';

3. use:

// 简易的方式
cxDialog('内容');

cxDialog('内容', () => {
  // click ok callback
}, () => {
  // click no callback
});

// 传入参数
cxDialog({
  title: '标题',
  info: '内容',
  ok: () => {},
  no: () => {}
});

4. Set default parameters:

cxDialog.defaults.title = '提示';

参数说明 Parameter

Must Read: Create Bootstrap 4 Modals In Pure JavaScript | Bootstrap Show Modal

名称类型默认值说明
titlestring标题
infostring
element
内容,可设置为文本内容,或 DOM 元素
okfunctionundefined确认按钮回调函数
※ 值为 function 类型时,才会显示对应按钮
nofunctionundefined取消按钮回调函数
okTextstring‘确 定’确认按钮文字
noTextstring‘取 消’取消按钮文字
buttonsarray[]自定义按钮
baseClassstring追加样式名称,不会覆盖默认的 class
maskClosebooleantrue是否允许点击遮罩层关闭对话框

buttons 参数

名称类型说明
textstring按钮文字
callbackfunction回调函数

API 接口

名称说明
close关闭对话框

See Demo And Download

modal-cxdialog-box-plugin

Official Website(ciaoca): Click Here

This superior jQuery/javascript plugin is developed by ciaoca. For extra Advanced Usage, please go to the official website.

Related Posts

Vector-Graphs-smartGraph

Generating Beautiful Vector Graphs With jQuery | smartGraph

SmartGraph is a free and easy-to-use JavaScript library to create beautiful vector diagrams with many customizations. This plugin allows developers to create dynamic, responsive, draggable vector graphics…

vue-image-slider-transition

Image Slider With 20 Cool Transitions Component | vue-flux

Vue flux is an image slider developed with Vuejs 2 that comes with 20+ nice transitions out of the box. Included transitions 2D transitions Fade: Fades from…

simple-parallax-scrolling

Simple background Image Parallax Scroll Plugin In jQuery

Background parallax effect is a simple jQuery background image without any library. Uses jQuery’s scroll() function to track the scroll event and applies the exact parallax scroll…

bootstrap-color-picker-plugin

Modular Color Picker Plugin for Bootstrap | BS Colorpicker

Bootstrap Colorpicker is a standard color picker plugin for Bootstrap 4. Colorpicker Plugin for Bootstrap 5/4/3 frameworks that allow you to add a color picker to an…

gdpr-iframe-manager-js

GDPR Friendly iFrame Manager In Vanilla JS | iframemanager

IframeMananger is a lightweight JavaScript plug-in that helps you to comply with GDPR by completely removing iframes at first and setting a notice related to that service….

diagonal-slider-anime-js

Diagonal Thumbnails Carousel Slider | Anime.js

Diagonal Slider is a cool mini carousel made with Anime.js JavaScript library. It takes a bunch of pictures and turns them into a circular user interface where…

Leave a Reply

Your email address will not be published. Required fields are marked *