html - jQuery auto select div on page load -


all. have jquery slides div's horizontally on click on links. problem on page load no link clicked no div visible (only ul visible). div id "page1" selected on page load. how that? i'm not posting html, few div's id's page1 through page9, , ul links referenced div id.

jquery:

jquery(function($) {     $('a.panel').click(function() {          var $page = $($(this).attr('href')), $other = $page.siblings('.active');         if (!$page.hasclass('active')) {              $other.each(function(index, self) {                  var $this = $(this);                 $this.removeclass('active').animate({ left: $this.width() }, 500);             });             $page.addclass('active').show().css({ left: -($page.width()) }).animate({ left: 0 }, 500);         }       return false;    }); }); 

thanks

suppose want show 1st link in a.panel trigger div show

just use

$(docmuent).ready(function () {     $('a.panel:nth(0)').click(); }); 

for 1st element use :nth(0)

for second :nth(1) index starts 0


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -