JCrop - FancyBox -- Jcrop 无法正常工作
Jcrop 在没有 fancybox 的情况下工作得很好。 但如果我在 Fancybox 中加载 Jcrop,我将无法裁剪图像。
图像在浏览器中显示两次。 我猜应该是css问题或者什么的。
有什么解决办法吗?
Jcrop is working good without fancybox.
But if i load Jcrop inside Fancybox, I am not able to crop the images.
Images are displayed two times in the browser.
I guess it should be a css problem or something.
Is there any solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
稍作修改的版本:
Slightly adapted version:
更新:在 Fancybox 2 中,“onComplete”函数已重命名为“afterShow”。如果您已升级,请相应地更改代码:)
尝试设置图像源并在 fancybox 的“oncomplete”回调上运行 Jcrop,它应该可以正常工作:
如果您没有设置图像的宽度和高度Jcrop 对象和 fancybox 在加载 Jcrop 对象后,您需要运行 $.fancybox.resize() 作为回调。由于您动态加载图像,fancybox 将以 0 的宽度和高度打开。
祝你好运!
Update: In Fancybox 2 the "onComplete" function has been renamed to "afterShow". Change code accordingly if you've upgraded :)
Try setting the image source and running Jcrop on the "oncomplete"-callback of fancybox and it should work just fine:
If you don't set a width and height of the Jcrop object and fancybox you need to run $.fancybox.resize() as a callback after you've loaded the Jcrop object. Since you're loading the images dynamically the fancybox will open with a width and height of 0 otherwise.
Good luck!