First, let me THANK YOU for a great module-- i've been trying to get this functionality for some time now (the other modules/solutions just didn't seem to work for me).
With this module I've gotten 99% of what I'm after-- so kudos and a big thanks.
My question is this, I'm trying to figure out how to very simply automate paging through the tabs-- nothing fancy, no plugins, just pure jquery. I'm assuming I just need to manipulate setting the "active" class on a timed basis somehow, but I'm not getting anywhere. If you have any suggestions or ideas to point me in the right direction, i'd be thrilled to contribute a patch back.
Comments
Comment #1
katbailey commentedHi WorldFallz,
I'm changing this to a feature request as I had given some thought to this idea and would like to include it in the next release of Quick Tabs. I can't say for sure when it will be available but if you're in a hurry and would like to start having a go yourself, here's the js code from a different custom module I had built which displays auto-rotating tabbed content (the content for that module was not in the form of views or blocks but I'm sure the jquery can be refactored for the purposes of QT blocks)...
The code makes the tabs auto-rotate but you can also have a pause and play button to control them. It would obviously need to be re-structured fairly drastically because this would have to be an option per QT block.
I changed some lines of the code that were a bit confusing, hopefully it'll make sense to you...
Comment #2
WorldFallz commentedThis is great-- more than I hoped for. I'm hoping to have some time to play around with it this weekend.
Not being one to be able to stop when i've gotten something 99% of the way completed, I continued playing with this into the night last nite. I finally cried uncle and went browsing around plugins.jquery.com and started playing around with the cycle plugin. It seems to be one of the higher quality plugins-- the core version (fade effect only) weighs in (packed) at 6kb and the full version (with all 27 transition effects) weighs in (also packed) at 10kb. Not bad for all that it does.
I managed to get close to the effect I was looking for with some css trickery and 1 line of jquery:
I'm not exactly 100% thrilled with this solution-- it feels hackish as i had to hide the tabs completely with css and use block titles instead of actually animating the styled quicktabs tabs. I might be able to fix this with some more time and/or changing the html output of quicktabs.
My question is this-- would you prefer to add simple pure jquery transitions (fade, slide) based on your code above, or enable a "use cycle plugin" option and provide a sensible interface to the plugin options. I'm torn-- I like the flexibility of cycle but I also like when modules are free of dependencies. As it's your module and i'd rather spend my time on something I can contribute back as a patch-- which direction would you prefer?
Comment #3
katbailey commentedActually I'd prefer to steer clear of plugins and do this with straight jQuery effects (fade, slide, etc). The options offered would be things like whether to display the titles on the tabs (as on www.spin.com - top left block), or just have numbers (as is often done with auto-rotating content) or dots (as on www.7x7sf.com - though this might be stretching things a bit far), whether to have pause on hover and play on mouseout or just pause and play buttons, and things like that - I think those are the most important options rather than just different transition effects.
I hope that's not too negative a reply after you spending time on the cycle plugin (which does look great, I just don't want such dependencies).
Thanks for your help with this :-)
Katherine
Comment #4
WorldFallz commentedNope--- it's not a negative reply at all. I agree with your preference. I tend to steer away from modules with dependencies whenever possible (though ironically, both my modules have them, lol).
But don't thank me yet-- i'm still learning jquery and it may take a little while for me to figure out how to integrate this code into the module. It will be a good learning experience though.
Comment #5
Mike Sances commentedThis is a great module and seems more stable than jcarousel, nodecarousel, and panels carousel. I'd love to see the automated scrolling feature also.
Comment #6
patrickkhong commentedjust wondering if this feature is going to bei n the next version after 5.x-1.4?
Comment #7
WorldFallz commentedi haven't been able to get it to work natively yet (i'm using the jquery cycle plugin atm) and my work has taken a different turn for the moment. i do plan to resume trying to get a patch together once i have some free time. in the meantime, you can always use cycle to add it manually.
Comment #8
stephthegeek commentedDitto #5, this module really rocks compared to others and I'd love to see this as a feature, along with transitions.
(Updated title to make this easier to find)
Comment #9
pasqualleMoving new features to 3.x version
Comment #10
wayne57 commentedWould love this functionality, it has been requested fro some time.
I cannot see the 6.x-3.x.dev version on the module download page. When will it be available?
Comment #11
mitchell commentedsubscribing
Comment #12
bradweikel commentedI just threw this together and thought others might be interested. It's not a proper patch, but can be easily applied to any theme by dropping it in script.js in your theme folder. All it does is rotate through the tabs and then cycle back around when it gets to the end. No fancy effects, just simulated mouse clicks.
You'll need to make 2 changes:
1) replace ul.quicktabs-style-spotlight with the corresponding name of your QuickTabs style. Mine is a custom style called "spotlight", so just change spotlight to the name of your style. Make the change in two places.
2) replace #quicktabs-home with the corresponding name of your QuickTabs block.
one more caveat: I had to fiddle with the CSS for that #quicktabs-home div to get the mouseover part working. Specifically, I had to set the height and width. If you don't do that, the rotation will work but it won't pause on mouseover.
@ maintainers - If you update me on your development plan and advise me on the UI, I can work on polishing this, generalizing it, and making a suitable patch. Just wanted to get something working, in the meantime, without hacking the module.
Comment #13
pasqualle@sleepcamel: my current plan is to work on the D7 port and make all the crazy style features implemented with a pluggable system..
hopefully for most ideas the implementation is already part of D7 core with jQuery UI (check rotate on http://jqueryui.com/demos/tabs/#methods) so we just need to enable the features..
after that I will probably have some ideas how it should be done in D6, but I doubt that I will have the time to implement it..
but adding new features without hacking the module is always a good solution..
Comment #14
cbassig commented@sleepcamel - does your theme script.js code only work with the 6.x-3.x.dev version of the module? I tried to get it to work with the 6.x-2.0-rc4 version and it wasn't doing anything.
It would be great to have this functionality.
Thanks
Comment #15
bradweikel commented@cbassig, I wrote it while using 6.x-2.0-rc3, so I'd assume it would work for rc4 as well. I'd read through my steps again to make sure you didn't miss any of the edits - it definitely won't work if you just drop it in without editing to fit your setup. If your site is visible somewhere give me a link and I can take a look (but not until next week, most likely).
Also, I'm not sure if all themes automatically include script.js, so make sure it's actually being included (or try putting it inside a script tag in a .tpl file). I'm using a custom subtheme of blueprint, which seems to include it automatically.
Comment #16
kaynen commented@cbassig - I'm using rc4 and that script worked once I changed the order of the setTimeout call to after the definition of the featurerotate function. Otherwise, it threw a javascript error saying that the setTimeout didn't work.
Comment #17
cbassig commented@sleepcamel - Thanks, I did make sure of the edits and the theme did have a script.js. I was able to get it to work enough for the time being through another route. (sorry I forgot to respond earlier)
@kaynenh - Thanks for the information. I will give this a try to see if it solves the problem when I have time to go back and work on that particular project.
Comment #18
bradallenfisher commentedComment #19
bradallenfisher commentedI added some fade effects... which are kind of generic...
Is there any way to add better transitions... without a plugin?
Comment #20
rtdean93 commentedThanks for the help. I am writing for instructions on how to implement this. I am a newbie and patches - so I am not sure which file I need to add this code to and where.
Also, will this work for the 6.x-3.x-dev version?
Thanks
Comment #21
rtdean93 commentedI was able to figure this out but have one question - HOW DO I STOP THE AUTO SCROLL - when I have clicked on a tab or am hovering over the tab?
I read above and have tried to adjust the css file, but it is not helping. Any advice is helpful.
Thanks
Bobby
Comment #22
ricardoserra74 commentedHi:
I´ve included the code above into quicktabs.js, and it works fine but only if i´m connected as administrator ...
any help?
I´m an absolut newbie
Thanks for all your effortS!
Comment #23
bradweikel commented@recardoserra74 - not sure how the admin part fits in, but you should definitely NOT be pasting this into quicktabs.js, because then you won't be able to upgrade your quicktabs module without losing your changes. You should instead put it in your theme directory. If your theme doesn't already have a .js file, create script.js, paste in the code, and then add that file to the list in your theme's .info file.
Comment #24
ricardoserra74 commentedHi Brad:
- Script.js created with the code and put it in my theme directory (didn´t exist any .js in that folder)
- added the line: scripts[] = script.js in my theme´s .info file
Now i can´t see rotation in quicktabs neither logged in or not ...
any suggestion...?
Comment #25
bradweikel commented@ricardo - First you should confirm that the .js is actually being included by inspecting the HTML being output by Drupal. This will either by really obvious or somewhat obfuscated, depending on your caching settings at /admin/settings/performance. If it's not being included, you probably just need to clear your cache. If it is being included but isn't working, I don't have an easy answer... you just need to debug it.
Comment #26
eL commentedHere we have different approach, but as in here, only "almost there"
http://drupal.org/node/461266
Comment #27
eL commentedHow about to randomize tabs apperance?
Comment #28
escoles commentedSuggestion for people doing ad hoc implementations: Take a look at the js_injector module.
(also, take this as an implicit endorsement of the concept -- we have been using a lot of quicktabs, due to their simplicity, and adding a baked-in scrolling capability would be wonderful.)
Comment #29
broncomania commented+1 from me for baked in autorotation feature
Comment #30
ralt commentedFinally got that working!
Thanks for the code up there. Actually, none of them worked because of a little bug.
It was actually just a little change to #19's code that was needed. Maybe it's because I already use Views Slideshow on this page, but quicktabs just wasn't cycling.
I changed
$(document).ready(function(){(line 1) toDrupal.behaviors.QuickTabsBehavior = function() {. And it suddenly worked like a charm!(new JS code attached)
EDIT : uh, looks like d.o doesn't like my attached files. So, just FYI, there are two lines modified : the first and the last. New lines :
Comment #31
tsi commentedHere is my version, nothing major has changed, replace "#quicktabs_container_ID" with your quicktabs container ID :
Comment #32
sgerbino commentedI needed to alter this code a bit to get it working on Drupal 7, hopefully I can save someone else some time by sharing this. Thank you to all who shared theirs.
Replace #quicktabs_container_ID with your quicktabs ID.
Comment #33
bryancasler commentedThis is awesome, thank you. I'm going to consider replacing my content slider with this.
Comment #34
yadranko commentedWhat is the proper #quicktabs_container_ID format? I tried replacing it with:
10
container-10
container_10
quicktabs_container_10
Cleared cache in each attempt, none is successful.
Comment #35
yadranko commentedOK, just realized I was running a wrong version. Upgraded to 6.x-3.0-beta1 and found the #quicktabs_container_ID (#quicktabs_container_latest_news) and it now works, well kinda.
In my case I have a quicktab container with multiple quicktabs in it and also a block in each one of those inner tabs, so my autoscrolling happens on the tab items of the selected container tab (scrolling its items) instead of scrolling from one outer tab to another. Not sure how to get it to work.
The problem must be in one of these lines:
the above is code from the reply #31 by tsi
Comment #36
wheresjbob commentedWhere do I find my quicktabs ID? Do you mean the machine name for the instance? Thanks!
Comment #37
wheresjbob commentedI'm hoping someone can provide some guidance. I'm relatively new to adding JS and this is my first use of quicktabs. I'm using Drupal 7 and trying to use the code from #32.
I have a custom homepage made of panels and the quicktabs block is in one of regions of that panel page. The content from each of 5 tabs is created by Views and exposed as blocks, so I'm adding the block for each view to the tabs.
The machine name for my quicktab instance is home_page_tabs. Which of these lines (if any) would be the correct syntax for "#quicktabs_container_ID with your quicktabs ID.":
I've tried all variations (I think) with no luck. I have the code from #32 in separate autotabs.js file in my theme's js folder and have updated my theme's .info file
Any ideas? Thanks in advance.
Comment #38
byant commentedsubscribe
Comment #39
technikh commented+1 subscribing..
Comment #40
silverfly commented@ wheresjbob - Try adding "quicktabs-" to your quicktabs ID. Like so: #quicktabs-home_page_tabs
Comment #41
rajeevkI am using D7 & trying to use code from comment #32.
It's not working at all. What I am doing is - adding a JS file to theme & declaring it in .info file. I checked with firebug in header & yeah it's uploaded.
ID for my quicktab is "quicktabs-container-front_page_tab" & so that I replaced all "#quicktabs_container_ID" with "#quicktabs-container-front_page_tab" cleared the cache, but it didn't work at all..
Is there anything which I am missing?
Comment #42
akalata commented@Rajeevkr - I would guess the ID you would use is "#quicktabs-front_page_tab" (not the one with 'container' in it, since that div does not include the ul.quicktabs-tabs, which is also part of the target).
Speaking of the targets, two other things in #31 needed to get changed for this to work for me in the current version, "quicktabs-tabs" and "quicktabs-tabpage" (note the hyphen instead of underscores, examine your HTML to see which version you'll need to use).
And finally, make sure that whatever scripts.js file you're using is included in your theme's .info file. I just spent 15+ minutes trying to figure THAT one out. :D
Edit: remembered one other thing -- check to make sure that you are not using the AJAX loading method for your tabs. While it may work on a technical level, my tabs did not see to like it at all (weird flashes, showing out of order, etc).
Comment #43
Anonymous (not verified) commentedI had to change som style declarations to use it with the jquery ui tab styles.
The code based on #32. Thx for sharing this peace of code.
Comment #44
netw3rker commentedBumping this to 7.x-3.x because this is a feature request.
Comment #45
smustgrave commentedWith D7 EOL approaching in a month I'm starting to triage the D7 side of quicktabs queue. This doesn't appear to have any code so believe this may not make it, sorry! Thanks though!
If still an issue or needed for 4.0.x (latest branch) feel free to reopen