iziModal使用过程遇到的问题

本文介绍了iziModal插件的基本使用方法,包括如何引入必要的文件、通过按钮触发模态窗口及配置选项等内容,并分享了一个常见问题及其解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

iziModal是一款时尚炫酷的jquery模态窗口插件。该模态窗口插件提供基本的打开模态窗口动画特效,并且可以调用iframe内容,Ajax加载,制作alert效果,加载超大内容等。

//1.使用方法

//在页面中引入iziModal.min.css和jquery、iziModal.min.js文件。

<linkrel="stylesheet"href="iziModal.min.css">
<scriptsrc="jquery.min.js"type="text/javascript"></script>
<scriptsrc="iziModal.min.js"type="text/javascript"></script

//2.可以通过按钮或<a>元素来触发一个模态窗口。
<!-- Trigger to open Modal -->
<ahref="https://www.baidu.com"class="trigger">打开模态窗口</a>
<!-- 模态窗口 -->
<divid="modal">
    <!-- 模态窗口的内容 -->
</div

$(document).on('click','.trigger',function(event) { //通过.trigger触发
    event.preventDefault();
    $('#modal').iziModal('open',event);// 注意上面传下来的是event事件,不要写成this
});  
//要在模态窗口中使用iframe功能,结构如下: 

//初始化:

1
2
3
4
5
$("#modal").iziModal({
   title : '你的标题',
   iconClass : 'icon-settings_system_daydream',
   transitionIn : 'transitionIn',
   transitionOut : 'transitionOut',
   headerColor : '#fff',
   theme : 'light',
   width : 1000,
   iframeHeight: 550,
   overlayClose : true,
   iframe : true
});    

  • Opening:在模态窗口打开时触发。
    1
    2
    3
    $(document).on('opening','#modal',function(e) {
        //console.log('Modal is opening');
    });
  • Opened:在模态窗口打开之后触发。
    1
    2
    3
    $(document).on('opened','#modal',function(e) {
        //console.log('Modal is opened');
    });
  • Closing:在模态窗口关闭时触发。
    1
    2
    3
    $(document).on('closing','#modal',function(e) {
        //console.log('Modal is closing');
    });
  • Closed:在模态窗口关闭之后触发。
    1
    2
    3
    $(document).on('closed','#modal',function(e) {
        // console.log('Modal is closed');
    });
以下是我用这个插件遇到的问题

 <li style=“margin-left: 2%;”>项目
    <a style="cursor:pointer;text-decoration:none;"  
   class="trigger"   th:href="@{/project/projectDetails(projectId=${project.projectId})}" > 
<span th:text="${project.projectName}"></span>
   </a>
</li> //标签里的变量记得改自己的

这样我一直打不开模态框,找了挺久,调试才知道,因为我的a标签里加了span标签,加了span标签之后通过class得到的targer是span,

所以模态框打不开,后来将span去调就可以了

修改后:

 <li style=“margin-left: 2%;”>项目
   <a style="cursor:pointer;text-decoration:none;"  
 class="trigger"th:text="${project.projectName}" th:href="@{/project/projectDetails(projectId=${project.projectId})}" > 
</a>
</li>



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值