April 18, 2024, 02:27:11 pm
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Welcome to Revolution X, where Coding meets Graphics.
 
  Home Help Search Arcade Affiliates Staff List Calendar Members Login Register  

Move the Navigation

Pages: [1]   Go Down
  Print  
Author Topic: Move the Navigation  (Read 504 times)
0 Members and 1 Guest are viewing this topic.
Celebrus
Artificially Conscious
Administrator
Adminitrator
Offline Offline

Gender: Male
Posts: 626



View Profile WWW
Badges: (View All)
Apple User
« on: February 02, 2009, 01:24:03 am »

Preview: http://celebrusisawesome.smfforfree.com/

First, ensure you have the jQuery include in your headers. It looks somewhat like this-
Code:
<script src="/jquery.js" type="text/javascript"></script>

Next, put this wherever your new tabs should appear.
Code:
<div id="_nav"></div>
In the preview, I put it at the very top of my headers.

Finally, add this to your footers.
Code: (javascript)
<script>
/*
 * Code created by Celebrus
 * - www.vikhyat.info
 * - aetus.net
 * - revolutionx.smffofree3.com
 */
// EDIT AFTER THIS IF YOU WANT TO.
reclass =                        "mirrortab";            // decides the root, try changing it to 'maintab' and see what happens
align_to_right =               true;                    // true/false
get_rid_of_top_padding =  false;                   // works better when 'reclass' is set to 'maintab'. once again, true/false
// EDITING ANYTHING AFTER THIS WILL VOID YOUR WARRANTY.

$(".maintab_active_back:contains(Home)").parent().parent().parent().appendTo("#_nav");
$(".maintab_back:contains(Home)").parent().parent().parent().appendTo("#_nav");
if(align_to_right)$("div#_nav").css("float","right").next().css("clear","both");
if(get_rid_of_top_padding)
{
  $("body").css("padding-top","0");
  $("#_nav").css("margin-bottom","10px")
}
$("div#_nav td.maintab_back").removeClass("maintab_back").addClass(reclass+"_back");
$("div#_nav td.maintab_first").removeClass("maintab_first").addClass(reclass+"_first");
$("div#_nav td.maintab_last").removeClass("maintab_last").addClass(reclass+"_last");
$("div#_nav td.maintab_active_back").removeClass("maintab_active_back").addClass(reclass+"_active_back");
$("div#_nav td.maintab_active_last").removeClass("maintab_active_last").addClass(reclass+"_active_last");
$("div#_nav td.maintab_active_first").removeClass("maintab_active_first").addClass(reclass+"_active_first");
</script>

Customization:
As you can see, there are 3 variables you can edit. They should be more or less self-explanatory, but I'll explain them.
reclass: This variable decides what the 'root' class of your new navigation will be. With 'maintab', the curved edges will be at the bottom. It looks like the default tabs. With 'mirrortab' the same thing would be inverted. In the preview, it is set to 'mirrortab'.
align_to_right: In the preview, you'd see that the tabs are to the right of the page. If you want it to be on left, change this to false. (without quotes)
get_rid_of_top_padding: This will basically stick the tabs at the very top of the page (with no gap) if you put the <div> on top of your headers.

Further customization:
If you want to customize it further, such as adding padding, and you know what you are doing, you can customize it with CSS using the div#_nav rule.

Notes:
1. This was inspired by sibyl's Endless theme which was a conversion of one by Crip.
2. I don't know if it's legal to have an underscore at the start of an id.

Disclaimer: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Report Spam   Logged

Share on Facebook Share on Twitter

Agent Moose
Administrator
Adminitrator
Offline Offline

Gender: Male
Posts: 1,470



View Profile WWW
Badges: (View All)
Tenth year Anniversary Nineth year Anniversary Search
« Reply #1 on: February 02, 2009, 06:50:34 am »

Nice code Smiley

I will probably test it out later to see how it looks.

Also, it isn't illegal to start an id with an underscore...as far as I know.  I've done it alot ;P
Report Spam   Logged


deathwilldie
Administrator
Adminitrator
Offline Offline

Posts: 1,769


View Profile WWW
Badges: (View All)
Tenth year Anniversary Nineth year Anniversary Level 5
« Reply #2 on: February 02, 2009, 05:27:28 pm »

That's pretty cool!  I like the little Disclaimer thingy you put in small print Tongue
Report Spam   Logged

Mojobojo82
MVP
MVP
Offline Offline

Gender: Male
Posts: 838


View Profile
Badges: (View All)
« Reply #3 on: June 17, 2009, 06:00:56 am »

Nice Code! Looks better up there Smiley
Report Spam   Logged






Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum

Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy