$(document).ready(function(){ $(‘#accordion > li ul’) .click(function(event){ event.stopPropagation(); }) .filter(‘ :not(:first)’) .hide(); $(‘#accordion > li,#accordion > li > ul > li’).click(function(){
Month: December 2012
Simple accordion menus
$(document).ready(function(){ $(‘#celebs ul > li ul’) .click(function(event){ event.stopPropagation(); }) .filter(‘ :not(:first)’) .hide(); $(‘#celebs ul > li’).click(function(event){ var selfClick=$(this).find(‘url:first’).is(‘visible’); if(!selfClick){ $(this)
Dropdown with hover intent
$(document).ready(function(){ $(‘#menu li ul’).css({ display:”none”, left:”auto” }); $(‘#menu li’).hoverIntent(function(){ $(this) .find(‘ul’) .stop(true,true) .slideDown(‘fast’); },function(){ $(this) .find(‘ul’) .stop(true,true) .fadeOut(‘fast’); }); });
Expandable menus
$(document).ready(function(){ $(‘#menu > li > ul’) .hide() .click(function(event){ event.stopPropagation(); }); $(‘#menu > li’).toggle(function(){ $(this).find(‘ul’).slideDown(); },function(){ $(this).find(‘ul’).slideUp(); }); }); #menu {
scrolling gallery
$(document).ready(function(){ $(‘#pic_container’).click(function(){ var numberOfPics=$(this).find(‘div > img’).length; var next = Math.floor(Math.random()*numberOfPics); $(this) .scrollTo( ‘#pic_scroller>img:eq(‘+next+’)’,{duration:1000} ); }); }); /** * jQuery.ScrollTo *
thumbnail scroller
$(document).ready(function(){ $(‘#photos_inner’).toggle(function(){ var scrollAmount = $(this).width()-$(this).parent().width(); $(this).animate({‘left’:’-=’+scrollAmount},’slow’); },function(){ $(this).animate({‘left’:’0′},’slow’); }); }); #photos { overflow: hidden; width: 600px; } #photos_inner {
cycle สามารถทำ shuffle,zoom, fade,turnDown,curtainX,scrollRight
ไม่ support IE 6 $(document).ready(function(){ $(‘#photos’).cycle({ fx:’shuffle’ //เปลี่ยนได้ shuffle,zoom, fade,turnDown,curtainX,scrollRight }); }); /* * jQuery Cycle Plugin (with Transition Definitions)
Inner fade
$(document).ready(function(){ $(‘#news ul’).innerfade({ animationtype:’slide’, speed:750, timeout:3000, type:’random’ }); }); /* ========================================================= // jquery.innerfade.js // Datum: 2008-02-14 // Firma: Medienfreunde Hofmann
slide cross fade
$(document).ready(function(){ rotatePics(1); }); function rotatePics(currentPhoto){ var numberOfPhoto=$(‘#photos img’).length; currentPhoto=currentPhoto % numberOfPhoto; $(‘#photos img’).eq(currentPhoto).fadeOut(function(){ $(‘#photos img’).each(function(i){ $(this).css( ‘zIndex’,((numberOfPhoto-i)+currentPhoto) % numberOfPhoto );
