I've created some code which people can copy and paste into their websites, and it should work in blogspot. This code requires jQuery and the jCarousel plugin. I use
if (typeof jQuery == "undefined") but for the jCarousel plugin to work jQuery must be loaded first, so this causes the post to load but the carousel to break.
Anybody know any solutions?
Can't you check for the existence of jQuery and still load jCarousel after that?
On second thought, I am not convinced this will always work. I don't think this guarantees that jQuery will load before jCarousel. I came up with an alternate solution that seems to be more robust. It makes sure that jQuery is loaded, and then uses jQuery to load the library using
$.getScript(). Then your code is called from the callback of
getScript. This ensures that everything happens in the proper order:
(Change the Framework in the left column to any version of jQuery, or some other library. It should always load the carousel correctly)
This version is similar, but uses a
<head> load for the lib, just like for jQuery. It is faster than
©2020 All rights reserved.