<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" > <meta name="author" content="lukasz_os" > <script type="text/javascript"> function rotate(){ last=$("#container .news").index($('.news:last')[0]); ind=$("#container .news").index($('.news:visible')[0]); $('.news').eq(ind).hide(); if(ind==last){ ind="0"; } else { ind++; } $('.news').eq(ind).show(); } $().ready(function(){ $('#container .news:first').show(); var inter = setInterval("rotate()",2000); $(".tit").click(function() { clearInterval(inter); var href = $(this).attr("href"); $('.tit').css('background-color', 'white'); $(this).css('background-color', 'green'); $('.news').hide(); $(href).show(); return false; }); }); </script> <style type="text/css"> * { margin:0; padding:0; } body { background:#ffffff; color:#000; } .news { width:300px; height:200px; border:1px solid #000; display:none; } #container { margin:20px; width:302px; height:202px; } </style> </head> <body> <div id="container"> <div class="news" id="#n1" style="background-color:red;"> div 1ijiojiji </div> <div class="news" id="#n2" style="background-color:green;"> div 2joijioj </div> <div class="news" id="#n3" style="background-color:black;"> div 3iojioj </div> <div class="news" id="#n4" style="background-color:yellow;"> div 4iojioj </div> </div> </body> </html>
Jednakze po kliknieciu przycisku div o id "href" sie nie wyswietla czy ktos wie czemu ?