<!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" /> <script type="text/javascript" language="javascript"> $(document).ready(function() { // LEFT COLUMN: // When the collapse button is clicked: $('.collapseLeft').click(function() { $('.collapseLeft').css("display","none"); $('.expandLeft').css("display","block"); $('#leftCol').animate( {height:"20px"}, {duration:400} ); $.cookie('leftCol', 'collapsed'); }); // When the expand button is clicked: $('.expandLeft').click(function() { $('.expandLeft').css("display","none"); $('.collapseLeft').css("display","block"); $('#leftCol').animate( {height:"500px"}, {duration:400} ); $.cookie('leftCol', 'expanded'); }); // RIGHT COLUMN: // When the collapse button is clicked: $('.collapseRight').click(function() { $('.collapseRight').css("display","none"); $('.expandRight').css("display","block"); $('#rightCol').animate( {height:"20px"}, {duration:400} ); $.cookie('rightCol', 'collapsed'); }); // When the expand button is clicked: $('.expandRight').click(function() { $('.expandRight').css("display","none"); $('.collapseRight').css("display","block"); $('#rightCol').animate( {height:"500px"}, {duration:400} ); $.cookie('rightCol', 'expanded'); }); // COOKIES // Left column state var leftCol = $.cookie('leftCol'); // Right column state var rightCol = $.cookie('rightCol'); // Set the user's selection for the left column if (leftCol == 'collapsed') { $('.collapseLeft').css("display","none"); $('.expandLeft').css("display","block"); $('#leftCol').css("height","20px"); }; // Set the user's selection for the right column if (rightCol == 'collapsed') { $('.collapseRight').css("display","none"); $('.expandRight').css("display","block"); $('#rightCol').css("height","20px"); }; }); </script> <style> body { background-color:#444444; position:relative; } #page { width:500px; margin:0 auto; text-align:center; background-color:#222222; padding:1px; } #leftCol { width:149px; margin-right:1px; height:500px; float:left; background-color:#666666; position:relative; } #rightCol { width:350px; height:500px; float:left; background-color:#333333; position:relative; } .expandLeft, .expandRight { width:11px; height:11px; background:url(http://www.shopdev.co.uk/blog/expand.gif) no-repeat; position:absolute; right:5px; top:4px; display:none; } .collapseLeft, .collapseRight { width:11px; height:11px; background:url(http://www.shopdev.co.uk/blog/collapse.gif) no-repeat; position:absolute; right:5px; top:4px; } </style> </head> <body> <div id="page"> <div id="leftCol"> </div> <div id="rightCol"> </div> <br clear="all" /> </div> </body> </html>
i chcę, aby domyślnie było rowinięte i w tym: <div class="informacja">tekst</div> i nie wiem gdzie to wkleić. Bardzo proszę o pomoc.
Jak ustwić domyślnie expand i gdzie wkleić div?
EDIT:
Postanowiłem zmienić kod, lecz nie działają mi w nim ciasteczka.
Co jest nie tak w poniższym kodzie?
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- #setup { color:#000; background-color:#fff; } #info { width:400px; padding:30px 20px; border:3px double #000; margin:20px auto; } #info p { margin:0; text-align:justify; } .hide { display:none; } .show { display:block; } --> </style> <script type="text/javascript"> <!-- var state; window.onload=function() { obj=document.getElementById('info'); state=(state==null)?'hide':state; obj.className=state; document.getElementById('setup').onclick=function() { obj.className=(obj.className=='show')?'hide':'show'; state=obj.className; setCookie(); return false; } } function setCookie() { exp=new Date(); plusMonth=exp.getTime()+(31*24*60*60*1000); exp.setTime(plusMonth); document.cookie='State='+state+';expires='+exp.toGMTString(); } function readCookie() { if(document.cookie) { state=document.cookie.split('State=')[1]; } } readCookie(); //--> </script> </head> <body> <div> </div> <div id="info"> <p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin massa. Nam vehicula. Morbi velit nisi, mollis id, ultrices luctus, adipiscing sit amet, lectus. Nunc rhoncus nisl ac enim. Maecenas vestibulum dolor ut velit. Maecenas condimentum pulvinar purus. Pellentesque ac ipsum. Curabitur sodales, elit vel molestie hendrerit, elit odio rhoncus tellus, nec gravida enim urna id velit. Donec nec tellus. Vestibulum nulla. Curabitur enim arcu, ornare id, placerat eget, nonummy vitae, mauris. Nulla rutrum semper odio. Duis vulputate ornare mauris. Praesent eget nibh sed ante ultricies scelerisque. Duis eget felis ut arcu porta bibendum. Mauris rutrum. Vivamus consectetuer purus sit amet mi. Suspendisse eu augue. </p> </div> </body> </html>