Closed (fixed)
Project:
Views Rotator
Version:
6.x-1.0-alpha2
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
15 Nov 2008 at 01:00 UTC
Updated:
21 May 2010 at 01:56 UTC
Hi,
I have a views rotator working on my site. I would like to add the functionality of Cycles Auto-Pager to the navigation between slides.
http://malsup.com/jquery/cycle/pager.html
I was thinking it might work if I added the following under jquery_plugin_add('cycle');
drupal_add_js(' $(document).ready(function() {
$("#views-rotator-home_slideshow-block_1").before("
Comments
Comment #1
halcyonandon commentedbefore("").cycle cut out a div tag with reference to the nav id, but I didn't actually miss it in my code FYI
Comment #2
halcyonandon commentedBy following the example at http://malsup.com/jquery/cycle/pager.html I was able to achieve the pagination functionality in my views rotator instance.
First off, any changes I made were done in the file "views-view-rotator.tpl.php" in the views_rotator module folder.
At the top of this file right under where I call the cycles plugin using " jquery_plugin_add('cycle');", I added the styles for the nav/pagination.
Below that I added this inline javascript...
"views-rotator-home_slideshow-block_1" will obviously be a name unique to your project. I also removed the
<span></span>tags containing the prev/next controls placed there by default. The end result is a pagination effect on my views rotator that works just like the example at that link. Hope this helps someone.Comment #4
m.stentaThanks to halcyonandon for the above code. It worked great for adding a pager.
I altered the code slightly to allow for multiple Views Rotator blocks on one page, by defining a unique pager ID. Add this to the top of views-view-rotator.tpl.php:
Comment #5
tsi commentedThis thread is great news for me !
Do you think an image pager is also doable ?
How can I do this ?
Thanks !
Comment #6
benleivian commentedThanks for this!
Comment #7
seutje commentedsomeone on IRC was using this method and noticed that the settings were being ignored, which makes sense, since ur effectively re-calling the cycle plugin on it, but without the settings, making the Drupal.behaviors.views_rotator pretty useless
instead, try this approach:
it will allow u to still use the settings, as it will still run through the original behavior, it'll just run a few things beforehand
hope this helps :)
Comment #8
bryancasler commentedThis patch #378842: Add support for the jQuery Cycle Pagers worked for me