WordPress.org

Ready to get started?Download WordPress

Forums

Testimonial Rotator
[resolved] Fix for non-javascript users, or slow-loading content flashiness (9 posts)

  1. kitchin
    Member
    Posted 9 months ago #

    If you have javascript disabled, all slides are displayed. We also had some reports of the slideshow "flashing". Not sure what they meant, and our content is very simple, but having used cycle2 I know sometimes all the content is initially visible even with javascript on, briefly.

    So the fix is easy, just a choice if you want to use pure css, or a css class in the html, or a style in the html, or filter hooks.

    * pure css : do not need to mod the plugin. Mess around with ".testimonial_rotator .slide { display: none } .testimonial_rotator .slide:first { display: block }". I didn't try it, since older browsers would probably fail to show anything.

    * css class in the html : mod the plugin html to add a class for all slides after the first. Then put a matching "display: none" rule in the css. This is probably the best solution for the developer.

    * style in the html : mod the plugin to add a style for all slides after the first. This is how I chose to do it, until the bug is fixed. I need max compatibility with old browsers, and this is easy.

    testimonial-rotator.php, version 1.3.6, line 417:

    $my_slide_style= ''; // add this line
    while ( $testimonials->have_posts() )
    {
    	$testimonials->the_post();
    	$slide = "<div class=\"slide cf-tr\"$my_slide_style>\n"; // add the variable
    	if($addClass) $my_slide_style= ' style="display: none;"'; // add this line

    And a similar fix at line 558.

    * filter hooks. Exercise for the reader. The hooks are testimonial_rotator_widget_slide and testimonial_widget_slide. Hint: you can use a static variable to keep track of the slide count.

    http://wordpress.org/plugins/testimonial-rotator/

  2. Hal Gatewood
    Member
    Plugin Author

    Posted 9 months ago #

    I'll add extra classes instead of inline styles. Look for it in an upcoming release.

    Thanks for the heads up.

  3. kitchin
    Member
    Posted 8 months ago #

    Another reason people use inline "display: none" for all slides after the first is because you never know when the extra stylesheet is going to load. I guess that particular spec for inline styles (all except first) would be OK for all slideshows, but maybe there's a case where it would be wrong. It would override any stylesheet, for one thing. It would be safe an option. ??

  4. kitchin
    Member
    Posted 8 months ago #

    I'm now using a fix that does not require modding the plugin.

    I put this in my theme style.css:

    div.testimonial_rotator_widget div.slide {
    	display: none;
    }
    div.testimonial_rotator_widget div.slide:first-child,
    div.testimonial_rotator_widget div.cycletwo-slide-active {  /* need this too for initial show */
    	display: block;
    }

    That will work except on very old browsers that understand "display: none" but not "first-child".

    I think this is more or less a bug in both the plugin and in jQuery Cycle2.
    1. The WP plugin: the slideshow should have a sane display when js is disabled.
    2. Cycle2: should not be necessary to add a style rule for "div.cycletwo-slide-active".

  5. Hal Gatewood
    Member
    Plugin Author

    Posted 2 months ago #

    In version 2.0+ the divs should all be hidden by default and the first will appear after the plugin has loaded!

  6. kitchin
    Member
    Posted 2 months ago #

    Thanks much! Works fine *except* when Javascript is off. Then it's blank. My fix in the theme's style.css is:

    div.testimonial_rotator_widget_wrap div.slide:first-child {
    	display: block;
    }

    Also note, readme.txt mentions testimonial_rotator_widget_blockquote for 1.3.3 so it should probably mention for a later version that class and others were removed.

    Is testimonial_rotator_widget_wrap likely stable?

  7. kitchin
    Member
    Posted 2 months ago #

    Also, the initial hide is pretty long. The widget is blank until the first slide fades in.

  8. kitchin
    Member
    Posted 2 months ago #

    My mistake, my CSS fix for JS off is actually causing the long initial hide when JS is on. I may come up with something better.

  9. kitchin
    Member
    Posted 2 months ago #

    The best solution for handling non-JS might be to take out the hammer and add this to your theme's head.php, where the stylesheet lines are:

    <noscript><style>div.testimonial_rotator_widget_wrap div.slide:first-child { display: block; }</style></noscript>

    And don't use the style.css rule three posts up.

    Jquery Cycle2 itself may just have a weakness degrading gracefully for non-JS. But the hammer works!

Reply

You must log in to post.

About this Plugin

About this Topic