Category: jQuery

layout switcher ปรับหน้าจอตามขนาดหน้าจอได้ ย่อขยายได้

$(document).ready(function(){ stylesheetToggle(); $(window).resize(stylesheetToggle); }); function stylesheetToggle() { if($('body').width()>900){ $('<link rel="stylesheet" href="wide.css" type="text/css" />') .appendTo('head'); }else{ $('link[href="wide.css"]').remove(); } } body #container { width: 850px; } body #container p { width: 650px;…

เปิดปิด Toggle

$(document).ready(function(){ $('#bio > div').hide();//div ที่อยู่ ใน bio จะ hide เครื่องหมาย > หมายถึงตัวลูกทุกตัว $('#bio > div:first').show();//show อันแรก ถ้าต้องการตัวที่สองของ div ให้ใส่เป็น div:eq(1)ไปแทน div:first $('#bio h3').click(function(){ $(this).next().animate( {'height:':'toggle'},'slow','easeOutBounce' ); }); });