防止 PrettyPhoto 关闭
我创建的脚本使用 PrettyPhoto 加载一个 iram,上面有一个上传页面,上传效果很好,图像已上传,URL 返回页面进行预览,但尚未保存到数据库中。 。 到目前为止一切顺利,我只是想添加一个功能,如果图片未保存并且用户点击关闭按钮,它将提示保存或关闭,它将进行 ajax 调用以删除上传的图片或保存其 url进入数据库
有谁知道如何做到这一点?不是ajax部分,我可以控制一切,只需要知道如何防止prettyphoto关闭按钮直接关闭
ps:我尝试了回调函数,但它关闭然后执行它的作用,但我需要执行完成在关闭之前,
任何帮助将不胜感激,
谢谢
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
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
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
any help would be much appreciated
thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以调整 PrettyPhoto js 代码,但这会影响所有弹出窗口,因此当您在 iframe 内找到关闭函数的解决方法时,就这样,您不必复制主题并隐藏其样式表上的关闭按钮,您可以简单地让 jquery 在 iframe 中执行此操作,只需将此代码包含到您的 iframe 中
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