Home › Forums › Pure Theme Discussion & Support › How can I make the slider stop on mouse rollover
This topic contains 12 replies, has 3 voices, and was last updated by themeweaver 9 years, 5 months ago.
-
AuthorPosts
-
November 18, 2011 at 3:55 pm #2117
Hi,
Any suggestions on how to make the slider stop on a mouse over and restart on a mouse roll off?
Larry
November 18, 2011 at 4:41 pm #2118Not supported by theme and not sure if the jquery slider being used would support that out of the box either.
But if you are a coder anything is possible. You’ll can review the slider component docs here:
http://flex.madebymufffin.com/November 18, 2011 at 10:38 pm #2127In the theme settings, it is possible to modify the slide change durations.
Where in the theme do those values get passed to the slider script?Reason for asking is that looking at the script, the paramenter “slideshowSpeed” is used by the script to set the speed.
By extending the code so it also passes the parameter “pauseOnHover = true” to the script, then it should do what Larry is asking.November 19, 2011 at 10:00 am #2128OK, that is quite easy to do. Hadn’t noticed it was just an option of the slider plugin.
1. You could hack base\lib\flexi-slider.php, editing the livingos_flexi_slider_init() function.
2. Better would be to remove the action that flexi-slider.php adds using wp’s remove_action() and role your own. That way you are not editing core theme code, so when you update the theme you don’t lose everything.
Either way you can add the parameter to the javascript that this function adds to the footer.
November 19, 2011 at 11:06 am #2129Tried the crude hack to the core theme file on my test site and it works ok.
…. [‘slider-time’]; ?>, pauseOnHover: true,
controlsContainer: “.flexslider-container”Looks like it would not be too hard for you to add this as a theme option on a future update?
pauseOnHover: false, //Boolean: Pause the slideshow when hovering over slider, then resume when no longer…
Another option to add could be:
slideDirection: “horizontal”, //String: Select the sliding direction, “horizontal” or “vertical”November 21, 2011 at 2:58 pm #2140Hi,
I made that change to the base flexi-slider.php and it worked just fine. Thanks.
However, I moved the change the /base/lib/flexi-slider.php in my child theme and it does not work.
Any ideas?
Larry
November 21, 2011 at 5:53 pm #2143You must keep base intact. WordPress will pick up template files you move, but this file is part of our theme framework.
If you used the remove_action method above, you shouldn’t need to change any code in base.
All you have to do is copy the code for livingos_flexi_slider_init() into your child theme and edit that.
November 21, 2011 at 7:29 pm #2147Try this in your child’s fucntions.php:
//modify felxi slider features - first remove action then addd a  new one<br /> function my_felxi_slider_change(){<br /> remove_action( 'wp_footer', 'livingos_flexi_slider_init' ); <br /> add_action( 'wp_footer', 'my_flexi_slider_init' );<br /> }<br /> add_action( 'init', 'my_felxi_slider_change' );<br /> <br /> function my_flexi_slider_init() {<br /> $options = get_option( 'livingos_theme_options' ); <br /> <br /> ?><br />    <script type="text/javascript"> <br />    jQuery(document).ready(function()  {<br /> jQuery('.flexslider').flexslider({<br /> animation: "<?php echo $options['slider-effect']; ?>",<br /> slideshowSpeed: <?php echo $options['slider-time']; ?>,<br /> controlsContainer: ".flexslider-container",<br /> pauseOnHover: true<br /> });<br /> }); <br />    </script><br />   <br />   <?php<br /> }
November 21, 2011 at 7:41 pm #2152Actually now gone one step further:
This extra feature is included in the example child theme for Pure available in the downloads section of Your Loom.
November 22, 2011 at 2:36 pm #2161Hi,
Thanks, I have the rolllover pause working.
“You must keep base intact. WordPress will pick up template files you move, but this file is part of our theme framework.”
I’m not an expert, but I thought the purpose of having a child theme was to permit such theme changes.
Larry
November 22, 2011 at 3:05 pm #2163WordPress automatically looks for the template files in your child theme folder. But they must be “template” files. The code in the framework (base folder) is functionality that comes with our themes and are not WP “template” files.
Standard template files are things like single.php, header.php etc – most of the files in the theme root and some of the buddypress folders. The rest is not treated in this way.
This is a WordPress feature and it does not look for other files.
Anyway the framework (the code in base folder) was written in a way that allows you to work with it in a child theme without changing anything in that folder, as shown in the example child theme we have just made available for download.
November 23, 2011 at 3:24 pm #2173Hi,
So non-CSS theme changes would be made in functions.php?
Larry
November 23, 2011 at 3:35 pm #2174Yes in the child functions.php and css changes in the child style.css or in theme options.
Of course if your are producing lots of extra code, then you are also free to structure your code in the theme into additional php files just as in any code project.
Though no theme covers every eventuality – it wouldn’t be a theme then, it would be another WordPress!
But if there is something specific you are trying to go, post it on the forums and someone will try and help.
-
AuthorPosts
You must be logged in to reply to this topic.