jQuery load and execute javascript / js and css file

if (jQuery('.startseitenslider').length > 0){
        jQuery('head').append('<link>');
        jQuery('head').children(":last").attr({
            rel:    "stylesheet",
            type: "text/css",
            href: "../css/nivo-slider.css"
        });

        function init_slider(){
            //$('#slider').nivoSlider();
        }
        jQuery.getScript("../js/jquery.nivo.slider.pack.js", function(){
            //wait before initialising to prevent intermittent load error
            setTimeout(init_slider,250);
        });
    }

Leave a Reply

Your email address will not be published. Required fields are marked *