/ Published in: JavaScript
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.
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.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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(); } }
URL: http://www.disas.de