Active
Project:
Rotor Banner
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
4 May 2009 at 08:23 UTC
Updated:
12 Mar 2013 at 04:08 UTC
Hello, I'd like to ask a little question...
Am I somehow able to add 2 arrows (just outside the Rotator block), that would make the rotator to switch to 'next' or 'previous' item?
Arrows are images inside the tag.
Thanks a lot for replies,
Tomas.
Comments
Comment #1
tom-a-spol-sro commentedummm, sorry I didn't expect that the form will parse the "a" tag into link :)
Comment #2
mrfelton commentedThis is really outside the scope or rotor.module. If you want to do this, you will need to write some JavaScript of your own. Rotor is powered by jQuery.cycle... The examples on this page should show you what you need to do: http://malsup.com/jquery/cycle/int2.html
Comment #3
tom-a-spol-sro commentedokay, I solved it myself, thanks to the link mrfelton provided.
For those who would want to do the same, it's really easy.
In the page, you have two arrows:
and when you open the rotor.js file, you change the code from:
to:
Comment #4
mrfelton commentedI'm upgrading this ticket into a feature request. I think it would be fairly simple to provide a means of specifying the css selector used to select DOM elements to be used as previous/next buttons.
Comment #5
GatorBat commentedMy apologies for reviving a year old topic, but I was looking for some advice/assistance. Is there a way to have next and previous buttons appear when one hover the mouse over a rotor? I was able to get the functions working adding in the lines from #3 into the rotor.js, but I was hoping to find a way to have them appear when one hovers over a rotor automatically. In case I am being unclear, you can find an example of the effect I'd like to achieve on the front page of the Steam website (http://store.steampowered.com/ - and my apologies if this feels like plug for their site). Any assistance/guidance would be greatly appreciated!
Comment #6
GatorBat commentedSo after about a week of brainstorming, I had an epiphany last in the wee hours of Thursday morning that I believe provides a decent solution to this request. I have refined a few thing this morning, and wanted to share what I'd done, in case it might help the Drupal Community and the Rotor Banner Module. Much thanks goes to #3 (tom-a-spol-sro) for the hints about adding the manual previous and next items that Malsup's JCycle already includes. This code relates to the 6.x-2.7 version of this module.
In the rotor.js file that comes with the module, I added the 2 lines mentioned in #3
Original rotor.js code (starts around line 28)
Modified rotor.js code
On my own site(s), I've created a custom content type I call a SpotLight. I've created my own view to have it cycle through items using taxonomy filters, and it functions more/less just like the included content Rotor type that this module includes (it uses Rotor for the style for transition setting and timings, and pulls fields for display).
In my Views UI, I added this bit of code to the header for any of my SpotLight displays that utilize the Rotor style. This creates/adds 2 small div regions that a place arrow graphic and corresponding prev/next text "buttons".
The final step was to add some CSS styling to get the 2 regions to display in the proper location, and hide/show based on the mouse hovering over the spotlight block. This was achieved using a similar technique to how Drupal core and other modules will have some options appear when you hover over a region, like the "Configure" option one typically gets when you hover over a block.
The results if anyone is interested can be seen on a live site http://www.ortho.ufl.edu/
The only caveat I have found is that for instances where you might have more than one rotor display on a page, the manual advance (prev or next) will rotate ALL displays using the rotor style.
mrfelton, if I were to add a similar cycle/items line item in the rotor.js that references a different selector, what's the likelyhood it would break the rotor functionality? I might try and test this on my own a bit on a test site, but in theory, add an addition cycle/item reference that would only have the manual advance functionality added, that would allow me to selectively chose which displays receive the manual advance command.
Comment #7
rezvani63 commentedThe solution for next and previous button in comment #3 is interesting. But I don't know where should I add these 2 lines?
In which page or file?
Comment #8
GatorBat commentedUsing the Views UI (/admin/build/views), select the View you wish to add those 2 lines to. On the configuration pane, you will see a section in the left column near the bottom called Header. Paste those 2 lines in there, and save your View. It should now display properly.
Comment #9
eric constantinides commentedhey tom-a-spol-sro and GatorBat, thanks for the help. This saved me a lot of time. I also ended up putting the delay of the slides to 9999 seconds so that now they only move when the user wants but still maintains the beauty of the rotor.
PS, to anybody else out there doing this, don't forget to clear your cache after making the changes to the JS. :)
Comment #10
pixelsweatshop commentedI think this is a great feature. I would recommend that this be added to an already great module.
Comment #11
thushad commentedI tried both #3 & #6. Works well when page only have a one rotor block. I have two rotor block in the page. When click on 'next' both rotor block jumping to next item. Please help me to solve this.