I have 4 blocks. Navigation position below them. What I want the ability to do is hard code a "NEXT" button within the block. I had it working in RC2 with the code.
<ul class="quicktabs_tabs">
<li class="qtab-2"><a href="/#quicktabs-1" class="qt_tab" id="block--1--2--block_delta_9--1"><img src="pathtotheme/next.png"></a></li>
</ul>
I tried doing this in RC3 with the following but now it just makes the block collapse.
<ul class="quicktabs_tabs">
<li class="qtab-1"><a id="quicktabs-tab-1-1" class="qt_tab" href="/frontpage?quicktabs_1=1#quicktabs-1"><img src="/next.png"></a></li>
</ul>
How would I go about hardcoding the next button into the block?
Thanks in advance.
-Jesse
Comments
Comment #1
pasqualleis this the link for the next tab?
you can get the correct link for any tab if you right click on the tab link and "Copy Link Location"..
you should remove the the extra id and class. This should work:
Comment #2
dobe commentedThat would work if I wanted the page to reload. But I want to retain the javascript capability. The issues is that the menu items that come stock with the Quicktabs use javascript to switch the element attributes of the #quicktabs_tabpage* from "display:none;" to "display: block" and the classes change from "quicktabs_tabpage nojs-hide" to "quicktabs_tabpage" on some sort of javascript event. How do I replicate this?
Thanks for the help I already attempted all that though!
-Jesse
Comment #3
pasqualleYou are right, that will make a page reload..
It is not possible to create the next button with a hard coded id and class any more..
But I think it is possible to do it with a little jquery snippet (quick sulution, untested)..
next button
additional js code for the next button based on Drupal.quicktabs.prepare
first tabindex is 0, second is 1..
If you manage to make it work with a general solution, please create a patch or add any comments here #348724: buttons for the next and previous tab as I would like such functionality included in the module..
if you insert this code to line 24 into quicktabs.js and add a css class "previous_tab" and "next_tab" to your buttons then this code may work (untested, possible problem with quicktabs inside quictabs)
Comment #4
dobe commentedAhh thanks so much Ill work on it and see where it takes me I'll let you know.
-Jesse
Comment #5
asak commented+1. i'm gonna give this one a shot.
Comment #6
Mauro Colella commentedOkay, I came up with a theme "hack". I am using this to change the drupal books navigation and make it act as back/forth buttons on quicktabs. See this page for an example : http://www.lightworkers-federation.com/content/tutorials
In your theme folder, backup your "script.js" file. Then add the following function (copied from the quicktab.js file).
Now, edit this code so that :
Becomes :
Then, add this at the top of your script.js file :
And add these functions also. If they already exist in your theme script file, edit them to insert the call to _init_page_links() where appropriate :
That's it.
This one works for books, but you can use it with elements styled using the class names "page-up, page-next, page-previous". The last elements in such collections will be converted to quicktab navigation links, automatically.
Comment #7
doublejosh commentedLooking to place links to the various tabs from within the first (overview) tab content.
Not sure how/where the qtid comes in.
Started by binding my links to the tabs on click events to prevent the page reload, and set the tab indexes...
How might I take care of
$('#tabLink0').qtid = XX;etc ?Comment #8
doublejosh commentedUpdate: Duh on the qtid!
But still not working...
Same HTML as above.
Comment #9
doublejosh commentedFeeling spammy sorry! Think perhaps I need to add the qtid and myTabIndex before the bind.
But now getting: Uncaught TypeError: Cannot read property 'tabs' of undefined (quicktabs.js:48)
Seems there is a "tabs" property that never gets attached/created for these link elements.
Final JS...
Comment #10
doublejosh commentedRather than binding the link, you can also click the tab via javascript.
In order to preserve the behavior of not jumping AND non-javascript failover, I wanted to leave the links as they are in the tabs. (Rather than changing the custom links to an #elementId matching the tabID. This meant some parsing non-sense in javascript. But it works, and allows the links to operate normally.
Then your custom HTML links can look just like the tab links...
Comment #11
pasqualleI guess this issue can be marked as fixed..
This is a solution with a little hack, if you can provide a patch with a good solution please add it to: #348724: buttons for the next and previous tab
Comment #12
doublejosh commentedI included that behavior in my theme scripts.js
Perhaps the module could have a setting (default off) that would add this javascript when QuickTabs are on pages.
Comment #13
doublejosh commentedRedid this in D7. Little cleaner this time...
Still works by adding a "tablink" class to anchors for processing.
Comment #14
abloomfield44 commentedThank you so much for this info! It works perfectly.
Comment #15
Steve Polito Design commentedI was able to use this to get it working in D7.
Comment #16
asanchez75 commentedmy two cents :)