Load CKeditor and Jquery on demand
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 visi开发者_StackOverflowble?
My CKEditor uses Jquery connector
Thank you
It depends on how you want to do it, but without seeing your mark-up I'd suggest trying something like:
$('a.editThis').click( // assuming that someone clicks a link of class-name 'editThis' to edit the page
function(){
$('<script src="/path/to/CKEditor.js"></script>').appendTo('head');
return false;
}
);
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
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
精彩评论