MIT License

项目介绍

vadimsva/popModal 是一个托管在 GitHub 上的开源项目,主要使用 HTML 编写,采用 MIT License 许可证,目前获得 152 个 Star、49 次 Fork。

仓库全名
vadimsva/popModal
开源许可证
MIT License
Star 数
152
Fork 数
49
未关闭 Issue
5

README 摘要

popModal ======== This library includes 4 components: popModal - popup window, displayed near the parent element. Invoked by clicking on an element notifyModal - notification popup, displayed on top of all elements. Invoked by event and hide after a certain time hintModal - tooltip, displayed near the parent element. Invoked on mouse hover on an element and hide after element lost focus dialogModal - modal dialog,…

完整内容见 GitHub 原始 README 或本页 。

常见问题

popModal 用什么语言开发?

主要使用 HTML 编写,采用 MIT License 许可证,目前有 152 个 Star。

popModal 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 popModal 的源码?

可以直接克隆仓库:git clone https://github.com/vadimsva/popModal.git,默认分支为 gh-pages;安装与运行步骤见仓库 README。

popModal 最近还在维护吗?

仓库最近一次更新为 2018年1月16日,当前有 5 个未关闭 Issue;Star 数为 152,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

jquery plugin for showing tooltips, titles, modal dialogs and etc

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
258
价值分
106
活跃状态
活跃

语言占比

CSS
HTML
JavaScript

Release

贡献者

README

popModal

This library includes 4 components:
popModal - popup window, displayed near the parent element. Invoked by clicking on an element
notifyModal - notification popup, displayed on top of all elements. Invoked by event and hide after a certain time
hintModal - tooltip, displayed near the parent element. Invoked on mouse hover on an element and hide after element lost focus
dialogModal - modal dialog, displayed on top of all elements. Invoked by clicking on an element

For work required only jQuery, other libraries are not required.

DEMO

Direct links to libs
popModal.js [18.2Kb]
popModal.min.js [10Kb]
popModal.css [10Kb]
popModal.min.css [9Kb]

Documentation

popModal

$(el).popModal({param1 : value1, param2 : value2, ...});

Parameters
html - static html, dinamic html, string, function (object, string, function). Use function if you want load content via ajax.
Use: el.append(html), $(el).html(), 'text' or function(){}

placement - popup position (string).
Use: 'bottomLeft' - default, 'bottomCenter', 'bottomRight', 'leftTop', 'leftCenter', 'rightTop', 'rightCenter'

showCloseBut - show/hide close button on popup (boolean).
Use: true - default, false

overflowContent - limit/no limit height of the content (boolean).
Use: true - default, false

onDocumentClickClose - close popup when click on any place (boolean).
Use: true - default, false

onOkBut - code execution by clicking on OK button, contained in popup (function).
Use: function(){}.
For work you need put an attribute to element - data-popModalBut="ok". Popup will close automatically

onCancelBut - code execution by clicking on Cancel button, contained in popup (function).
Use: function(){}.
For work you need put an attribute to element - data-popModalBut="cancel". Popup will close automatically

onLoad - code execution before popup shows (function).
Use: function(){}

onClose - code execution after popup closed (function).
Use: function(){}

Methods
hide - for close popModal.
Use: $('html').popModal("hide");

Notes
You may use external click function for element
$(el).click(function(){
  $(el).popModal({param1 : value1, param2 : value2, ...});
});
or use
$(el).popModal({param1 : value1, param2 : value2, ...});

Also you may use inline bind

<button id="elem" data-popModalBind="#content" data-placement="bottomLeft" data-showCloseBut="true" data-overflowContent="true" data-onDocumentClickClose="true">example</button>

Popup is dynamically created. When you create the second popup, the first will be deleted!
For create footer in popup, use element div with class=“popModal_footer”. You can use attribute for element data-popModalBut=“close” for close popup, also you can press ESC, or click on any place.



notifyModal

$(content).notifyModal({param1 : value1, param2 : value2, ...});

Parameters
duration - duration for show notification in ms (integer)
Use: 2500 - default, -1 for infinity

placement - position (string).
Use: 'center' - default, 'leftTop', 'centerTop', 'rightTop', 'leftBottom', 'centerBottom', 'rightBottom'

onTop - show notification popup on top of the content (boolean).
Use: true - default, false
With placement : 'center', onTop will work as true.
Notes
You can close this notification popup, by clicking on any place, close button or press ESC.



hintModal

hintModal();

Use: You need to create html with class=“hintModal” as parent element and put in this element div with class=“hintModal_container”, put here html, to be displayed.
To change position, add additional class class=“hintModal_center” or class=“hintModal_right” to parent element.

Notes
hintModal will be called automatically if document have elements with the class "hintModal".



dialogModal

$(content).dialogModal({param1 : value1, param2 : value2, ...});

Parameters
onOkBut - code execution by clicking on OK button, contained in dialog (function).
Use: function(){}.
For work you need put an attribute to element - data-dialogModalBut="ok". Dialog will close automatically

onCancelBut - code execution by clicking on Cancel button, contained in dialog (function).
Use: function(){}.
For work you need put an attribute to element - data-dialogModalBut="cancel". Dialog will close automatically

onLoad - code execution before dialog shows (function).
Use: function(){}

onClose - code execution after dialog closed (function).
Use: function(){}

Methods
hide - for close dialogModal.
Use: $('html').dialogModal("hide");

Notes
You may use external click function for element
$(el).click(function(){
  $(content).dialogModal({param1 : value1, param2 : value2, ...});
});
or use
$(content).dialogModal({param1 : value1, param2 : value2, ...});

Dialog is dynamically created. When you create the second dialog, the first will be deleted!
You need to create div elements with classes class=“dialogModal_header” - for show header, class=“dialogModal_content” - for show content, and class=“dialogModal_footer” - for show footer.
You can use attribute for element data-dialogModalBut=“close” for close dialog, also you can press ESC. To show collection of content, like pages in one modal dialog, use class for this dialogs. If you want to use collection of content, you can change content by clicking to arrows, or press left/right arrow on keayboard.

Examples

popModal

$(el).popModal({
  html : $(content).html(),
  placement : 'bottomLeft',
  showCloseBut : true,
  overflowContent : true,
  onOkBut : function(){},
  onCancelBut : function(){},
  onLoad : function(){},
  onClose : function(){}
});
$(el).popModal({
  html : function(callback) {
    $.ajax({url:'ajax.html'}).done(function(content){
      callback(content);
    });
  }
});

notifyModal

$(content).notifyModal({
  duration : 2500,
  placement : 'center',
  onTop : true
});

hintModal

<div class="hintModal">
  hover on me
  <div class="hintModal_container">
    text for hintModal
  </div>
</div>

dialogModal

$(content).dialogModal({});

评论

暂无评论