Are there any real benefits to including javascript dynamically rather than as script tags at the bo
Posted
by SB
on Stack Overflow
See other posts from Stack Overflow
or by SB
Published on 2010-04-16T07:12:48Z
Indexed on
2010/04/16
7:33 UTC
Read the original article
Hit count: 446
jquery-plugins
I've read that including the scripts dynamically may provide some better performance, however i'm not really seeing that on the small local tests I'm doing. I created a jquery plugin to dynamically load other plugins as necessary and am curious as to if this is actually a good idea. The following would be called onready or at the bottom of the page(I can provide the source for the plugin if anyone is interested):
$.fn.executePlugin(
'qtip', // looks in default folder
{
required: '/javascript/plugin/easing.js', // not really required for qtip just testing it
version: 1, //used for versioning and caching
checkelement: '#thumbnail', // will not include plugin if $(element).length==0
css: 'page.css', // include this css file as well with plugin
cache:true, // $.ajax will use cache:true
success:function() { // success function to be called after the plugin loads - apply qtip to an element
$('#thumbnail').qtip(
{
content: 'Some basic content for the tooltip', // Give it some content, in this case a simple string
style: {name:'cream'},
});
}
});
© Stack Overflow or respective owner