javascript - 从脚本手动调用库

标签 javascript jquery featherlight.js

我正在尝试手动调用featherlight库以从脚本创建弹出窗口,但不知道如何制作它。文档说:

In cases where you don't want an Element to act as Trigger you can call Featherlight manually. You can use this for example in an ajax callback to display the response data.

$.featherlight($content, configuration);

<script type="text/javascript">
    function validate_help_form() {
        valid = true;
        if (document.help_form.username.value == "") {
            $.featherlight('Error message', $.featherlight.defaults);
            valid = false;
        }
        return valid;
    }
</script>

那么我应该传递什么而不是配置对象来使其工作?

最佳答案

您的内容应该是 HTML(例如 "<p>Error message</p>" 、jQuery 选择器(例如 "div.my-class p" ,代表“错误消息”)等...阅读不同类型内容的文档

关于javascript - 从脚本手动调用库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38989174/

相关文章:

javascript - jQuery </div> 标签导致 NS_ERROR_XPC_BAD_CONVERT_JS

javascript - MongoDB - 根据用户名显示不同的内容

javascript - 通过命令行将 node.js 与无浏览器 jQuery 结合使用

javascript - 跟踪用户何时滚动经过数组中的 div

Featherlight.js 插件 : lightbox's width issue when content is an iframe

javascript - 表单提交中表示req.body为空

Javascript缓存问题

javascript - jQuery判断输入文件是否为空

jquery - 防止在打开灯箱时背景滚动