按需加载CKeditor和Jquery
我目前在我的网站上使用 CKEditor,但并非每次用户访问页面时都需要 CKEditor。流程如下:用户进入页面并看到该页面的所有文章;如果用户想要编辑文章,他或她会打开编辑器并执行此操作。目前,CKEditor 被加载到隐藏的 div 中,并且有 60% 的时间没有被使用。当用户单击并让编辑器 div 可见时,有什么方法可以按需加载它?
我的 CKEditor 使用 Jquery 连接器
谢谢
I currently use CKEditor on my website, however not every time users access the page CKEditor is needed. The flow is the following: user enters the page and see all the articles there; if users wants to edit the article he ou she opens editor and does that. Cureently CKEditor is loaded in the hidden div and not used 60% of time. Is there any way to load it on demand when user clicks and get that editor div visible?
My CKEditor uses Jquery connector
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这取决于你想如何做到这一点,但如果没有看到你的标记,我建议尝试类似的操作:
编辑以添加演示的链接,尽管这是附加 CSS 的演示。我想可以添加 javascript,接下来我会尝试一下。演示地址:我的网站
It depends on how you want to do it, but without seeing your mark-up I'd suggest trying something like:
Edited to add a link to a demo, albeit this is a demo of appending CSS. I'd imagine that javascript can be added though, and I'll try that next. Demo at: my site
对于其他不使用 JQuery 的人,他们应该知道 CKEditor 确实包含自己的惰性加载器:http://alfonsoml.blogspot.com/2009/09/delayed-loading-of-ckeditor.html
For other people that don't use JQuery, they should be aware that CKEditor does include its own lazy loader: http://alfonsoml.blogspot.com/2009/09/delayed-loading-of-ckeditor.html