我正在尝试手动调用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/