jquery插件fancybox的使用

华乐逸
2023-12-01

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Fancy</title>
    <link href="~/Content/fancyBox/jquery.fancybox.css" rel="stylesheet" />
   

</head>
<body>
    <div>
        <button onclick="show()"> 显示</button>
    </div>
</body>
<script src="~/Scripts/jquery-3.3.1.min.js"></script>
<script src="~/Content/fancyBox/jquery.fancybox.pack.js"></script>
<script>
    function show(key) {

         var action = 'add';
            if (key == undefined) {
                action = 'add';
                key = 0;
            } else {
                action = 'edit';
            }
            //调用fancybox弹出层   弹窗新增,编辑
            $.fancybox({
                helpers: {
                    overlay:
                    {
                        closeClick: false
                    }
                },
                autoscale: false,
                iframe: { 'scrolling': 'no' },
                padding: 20,
                height: 400,
                width: 800,
                autoSize: false,
                type: 'iframe',
                overlayShow:false,
                'href': '@Url.Action("Learn_Exper", "Home")?method=' + action + '&Key=' + key,
                'afterClose': function () {
                    initTable_LearningExperience();
                }
            });
    }
</script>
</html>
 类似资料: