Return to Snippet

Revision: 40302
at January 29, 2011 05:55 by disas


Initial Code
var subsite1 = document.URL.split("#")[1]
    var subsite2 = document.URL.split("#")[2]
    if(subsite1 == 1 || subsite1 == 2){
     $("#menu a:nth("+subsite1+")").click();
     if(subsite1 == 2 && subsite2 > 0){
      $("#portfolio a:nth("+((subsite2)-1)+")").click();
     }
     if(subsite1 == 3 && subsite2 > 0){
      $("#portfolio a:nth("+((subsite2)-1)+")").click();
     }
    }

Initial URL
http://www.disas.de

Initial Description
This snippet could be useful if you use an div based design eg. with a slider or something similar. it grabs variables from the base url splitted by "#".

So you can browse to your site like "http://www.example.com/#1#2" and use the first and second variable to emulate an click on a menu or an lightbox collection eg.  for opening an lightbox directly when you enter the site.

Initial Title
Emulate Click with jQuery on Page Enter / Direct Lightbox Opening

Initial Tags
page, jquery, load

Initial Language
JavaScript