0
votes

As per usual, a client has asked to stick a square peg in a round hole.

I am using the Flexslider module for a few pages, but they now want a mix of images and content slides. I have done this before not on a CMS, but I am having issues loading on my Drupal install. Is there a fix out there? I have added:

    drupal_add_js(drupal_get_path('theme','themename').'/js/jquery.flexslider.js');
    drupal_add_css(drupal_get_path('theme','themename').'/css/flexslider.css');

These are loading fine.

And then this to the page: $(window).load(function() { $('.flexslider').flexslider(); });

But, I am getting nothing for load.

1

1 Answers

0
votes

Apparently, I needed to become desperate and ask the internet.

My solution in template.php (yes, mytheme had some flexslider calls in it):

 function MYTHEME_preprocess_page(&$variables, $hook) {
//Add javascript based on content type
if (isset($variables['node']->type) && !empty($variables['node']->type ($variables['node']->type == 'flexslider_hiddenAKA:mycontent_type_for_this')){
    drupal_add_js(drupal_get_path('theme', 'MYTHEME') . '/js/plugins/jquery.flexslider-min.js');

//Initialize slideshow using theme settings
$effect=theme_get_setting('slideshow_effect','MYTHEME');
$effect_time=theme_get_setting('slideshow_effect_time','MYTHEME')*1000;
$slideshow_controls=theme_get_setting('slideshow_controls','MYTHEME');
$slideshow_random=theme_get_setting('slideshow_random','MYTHEME');
$slideshow_pause=theme_get_setting('slideshow_pause','MYTHEME');
$slideshow_touch=theme_get_setting('slideshow_touch','MYTHEME');

drupal_add_js('
    jQuery(document).ready(function($) {

        $(window).load(function() {

            $(".flexslider").fadeIn("slow");

            $(".flexslider").flexslider({
                useCSS: false,
                animation: "'.$effect.'",
                controlNav: '.$slideshow_controls.',
                directionNav: '.$slideshow_controls.',
                animationLoop: true,
                touch: '.$slideshow_touch.',
                pauseOnHover: '.$slideshow_pause.',
                nextText: "›",
                prevText: "‹",
                keyboard: true,
                slideshowSpeed: '.$effect_time.',
                randomize: '.$slideshow_random.',
                start: function(slider) {
                    slider.removeClass("loading");
                }
            });
        });
    });',array('type' => 'inline', 'scope' => 'footer', 'weight' => 5)
);


}

}