Mam do wykonania stworzenie menu newsów w js.
Mam dwie zakładki górna:
Nowe | Najpopularniejsze |artykuł dnia
i dolną:
1 | 2 | 3
Mam problem z połączeniem tych dwóch tabów, ażeby w momencie gdy kliknę Najpopularniejsze, dolny tab zmienił wartość 1 | 2 | 3 na divy które są w najpopularniejszych, a nie wyświetlał cały czas tego samego z zakładki nowe.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css"> body {font-family:Verdana, Arial, Helvetica, sans-serif;} .tab-box { width:400x; border-bottom: 1px solid #DDD; padding-bottom:5px; } .tab-box a { border:1px solid #DDD; color:#666666; padding: 5px 15px; text-decoration:none; background-color: #D0E7E0; } .tab-box a.activeLink { background-color: #7EDAC0; border-bottom: 0; padding: 6px 15px; } .tabcontent { border: 1px solid #ddd; border-top: 0; padding: 15px; background-color:#DDF3DE; } .hide { display: none;} .small { color: #999; margin-top: 100px; border: 1px solid #EEE; padding: 5px; font-size: 9px; font-family:Verdana, Arial, Helvetica, sans-serif; } .tab-box-bottom { width:400x; border-bottom: 1px solid #DDD; padding-bottom:50px; } .tab-box-bottom a { border:1px solid #DDD; color:#666666; padding: 5px 50px; text-decoration:none; background-color: #D0E7E0; } .tab-box-bottom a.activeLink { background-color: #7EDAC0; border-bottom: 0; padding: 6px 50px; } </style> <script type="text/javascript"> $(document).ready(function() { $(".tabLink").each(function(){ $(this).click(function(){ tabeId = $(this).attr('id'); $(".tabLink").removeClass("activeLink"); $(this).addClass("activeLink"); $(".tabcontent").addClass("hide"); $("#"+tabeId+"-1").removeClass("hide"); return false; }); }); }); </script> </head> <body> <div class="tab-box" style="width:400px"> </div> <div class="tabcontent" id="cont-1-1" style="width:400px"> NOWE 1 </div> <div class="tabcontent hide" id="cont-2-1"style="width:400px"> Najpopularniejsze 1 </div> <div class="tabcontent hide" id="cont-3-1"style="width:400px"> Artykul dnia </div> <div class="tabcontent hide" id="cont-4-1" style="width:400px"> NOWE 2 </div> <div class="tabcontent hide" id="cont-5-1" style="width:400px"> NOWE 3 </div> <div class="tabcontent hide" id="cont-6-1"style="width:400px"> Najpopularniejsze 2 </div> <script type="text/javascript"> $(document).ready(function() { $(".tab-box-bottom").each(function(){ $(this).click(function(){ tabeId2 = $(this).attr('id2'); $(".tab-box-bottom").removeClass("activeLink"); $(this).addClass("activeLink"); $(".tab-box-bottom").addClass("hide"); $("#"+tabeId2+"-1").removeClass("hide"); return false; }); }); }); </script> <div class="tab-box-bottom activeLink" id2="con-1" style="width:400px"> </div> </body> </html>
Dziękuję za wszelkie sugestie,
Pozdrawiam,
BlackHat