Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Author Topic: feeling stupid (small problem with tabbed menu)  (Read 4557 times)

harry_ej

  • Newbie
  • *
  • Karma: 1
  • Posts: 20
feeling stupid (small problem with tabbed menu)
« on: January 20, 2008, 04:39:11 PM »

I made a tabbed menu for my site with the sliding door and span method, everything works fine exceptt on the active link i cannot get the left part of the tab to come through.

In regular XHTML and css it is never a problem but iīm feeling very stupid nevertheless.

Here is an image of what i mean:



This is the CSS for the style of the active tab:

Quote
.tab .current span {
         background-position: 100% -84px;
         background: url("pics/rightact.jpg") 100% 0 no-repeat;
         color:#000;
      }
      .tab .current {
         background-position: 0 -84px;
         background: url("pics/leftact.jpg") no-repeat;         
      }
Quote

Here is the nav menu function in t he snews.php i used to generate the menu:

Quote
function navmenu() {
   $categorySEF = get_id('category'); $pageSEF = get_id('article'); $home = l('home_sef');
   $class = (empty($categorySEF) || $categorySEF == $home && empty($pageSEF)) ? ' class="current"' : '';
   echo '<li'.$class.'><a href="'.db('website').'" title="'.l('home').'"><span>'.l('home').'</span></a></li>';   
   $class = ($categorySEF == 'archive') ? ' class="current"' : '';   
   echo '<li'.$class.'><a href="'.db('website').'archive/" title="'.l('archive').'"><span>'.l('archive').'</span></a></li>';
   $query = "SELECT * FROM ".db('prefix')."articles WHERE position = 3 ORDER BY id";
   $result = mysql_query($query);
   while ($r = mysql_fetch_array($result)) {
      $title = $r['title'];
      $class = ($pageSEF == $r['seftitle'])? ' class="current"' : '';
      if ($r['id'] != s('display_page')) {echo '<li'.$class.'><a href="'.db('website').l('home_sef').'/'.$r['seftitle'].'/" title="'.$title.'">'.$title.'</a></li>';}
   }
   $class = ($categorySEF == 'contact') ? ' class="current"': '';
   echo '<li'.$class.'><a href="'.db('website').'contact/" title="'.l('contact').'"><span>'.l('contact').'</span></a></li>';
   $class = ($categorySEF == 'sitemap') ? ' class="current"': '';
   echo '<li'.$class.'><a href="'.db('website').'sitemap/" title="'.l('sitemap').'"><span>'.l('sitemap').'</span></a></li>';
}
Logged

sibas

  • Sr. Member
  • ****
  • Karma: 23
  • Posts: 451
    • www.simply4all.net
Re: feeling stupid (small problem with tabbed menu)
« Reply #1 on: January 20, 2008, 07:39:29 PM »

Try to remove 100% 0 in
Quote
background: url("pics/rightact.jpg") 100% 0 no-repeat;
Logged

harry_ej

  • Newbie
  • *
  • Karma: 1
  • Posts: 20
Re: feeling stupid (small problem with tabbed menu)
« Reply #2 on: January 22, 2008, 07:44:23 AM »

No that's not it. In my normal template it is working fine, so it maybe has something to do with the markup of the template Snews.

I might leave it like this, looks terrible but i just can't figure it out  :-\ :-[
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: feeling stupid (small problem with tabbed menu)
« Reply #3 on: January 22, 2008, 04:11:52 PM »

Harry... I don't know if this will help you or not... but I ran into a similar problem while porting Luka's Internet Sharing Template for sNews 1.5 and I did get it sorted. I don't have a copy of this running anywhere ATM but you might download the package and have a look at how the tabbed menu - also using the sliding doors method - is working in it. The template should work with 1.6 as well... just be sure to use the 1.6 function-names in the index.php along with its css file.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

henrich

  • Sr. Member
  • ****
  • Karma: 23
  • Posts: 381
  • Passion for quality and excellence!
    • My personal blog and portofolio
Re: feeling stupid (small problem with tabbed menu)
« Reply #4 on: January 22, 2008, 06:08:27 PM »

Harry, please try this:

Code: [Select]
.tab .current a span {
         background-position: 100% -84px;
         background: url("pics/rightact.jpg") 100% 0 no-repeat;
         color:#000;
      }
      .tab .current a {
         background-position: 0 -84px;
         background: url("pics/leftact.jpg") no-repeat;         
      }

Well anyway, you should associate this with the hyperlink rules, please take a look on my own navigation rules and get inspired :)

Code: [Select]
#navigation {
top: 71px;
float : right;
position : relative;
font : bold 13px/19px Arial;
text-transform : lowercase;
letter-spacing : 1px;
padding-right : 15px;
}

#navigation a {
color: #000000;
background: #cecece url("../img/nav_left.gif") no-repeat left top;
text-decoration: none;
padding-left: 10px
}

#navigation a span {
background: url("../img/nav_right.gif") no-repeat right top;
padding-right: 10px
}

#navigation a, #navigation a span {
display: block;
float: left
}

/* Hide from IE5-Mac \*/
#navigation a, #navigation a span {
float: none
}
/* End hide */

#navigation a:hover {
color: #ffffff;
background: #333333 url("../img/nav_left_h.gif") no-repeat left top;
padding-left: 10px
}

#navigation a:hover span {
background: url("../img/nav_right_h.gif") no-repeat right top;
padding-right: 10px
}

#navigation ul {
list-style: none;
padding: 0px;
margin: 0px
}

#navigation li {
float: left;
margin: 0px;
}

Logged
By(e) Henrich :)
------------------------------
IT related blog

harry_ej

  • Newbie
  • *
  • Karma: 1
  • Posts: 20
Re: feeling stupid (small problem with tabbed menu)
« Reply #5 on: January 23, 2008, 06:10:08 PM »

Heinrich, you are a legend, you deserve a statue ;D
 and iīm red with shame, should have seen it, just couldnīt figure it out. :-[

Itīs working like a charm now

harry



Logged

henrich

  • Sr. Member
  • ****
  • Karma: 23
  • Posts: 381
  • Passion for quality and excellence!
    • My personal blog and portofolio
Re: feeling stupid (small problem with tabbed menu)
« Reply #6 on: January 23, 2008, 09:02:58 PM »

Hehe, no, i am not a legend but i'm glad that i had the opportunity to help you and my suggestions was useful for you. All the best!
Logged
By(e) Henrich :)
------------------------------
IT related blog