简体   繁体   English

防止关闭PrettyPhoto

[英]Prevent PrettyPhoto from closing

the script i created uses PrettyPhoto to load an ifram on which there is an upload page going on, the upload works great the image is uploaded and the url is returned back to the page for preview, but not saved into the database just yet... so far so good, i just want to add a function that if a picture is not saved and the user hits close button it will promt to either save or dismiss which it will make an ajax call to either remove the uploaded picture or save its url into the database 我创建的脚本使用PrettyPhoto加载了一个ifram,该ifram上有一个正在上传的页面,该上传效果很好,可以上传图像,并且url返回到页面进行预览,但尚未保存到数据库中。到目前为止,我只想添加一个功能,如果未保存图片并且用户单击关闭按钮,它将提示保存或关闭,这将进行ajax调用以删除上传的图片或保存其网址进入数据库

does anyone have an idea how to do that? 有谁知道如何做到这一点? not the ajax part i have everything under control, just need to know how to prevent the prettyphoto close button from closing directly 不是ajax部分,我可以控制所有事情,只需要知道如何防止prettyphoto关闭按钮直接关闭即可

ps: i tried the callback function but what it does it that it closes then executes, but i need the execution to be done before closing ps:我尝试了回调函数,但是它关闭后执行的操作,但是我需要在关闭之前完成执行

any help would be much appreciated 任何帮助将非常感激

thank you 谢谢

you can tweak the prettyPhoto js code but that will effect all your popups, so as you found the workaround of the close function inside the iframe then that's it, you didn't have to duplicate themes and hide the close button on the its stylesheet, you could have simply let jquery do so from withing the iframe, just include this code into your iframe 您可以调整prettyPhoto js代码,但这会影响您所有的弹出窗口,因此,当您在iframe中找到close函数的解决方法时,就是这样,您不必复制主题并在其样式表上隐藏close按钮,您可以简单地让jquery从iframe中进行操作,只需将此代码包含到iframe中

<script type="text/javascript">
$(document).ready(function() {
     window.parent.$('.pp_close').css('display', 'none');
});
</script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM