JS or jquery: get array index when using inArray
How would I get the index of a matched array value when using inArray?
I currently have this!
startHere = 0
var slides = new Array();
slides[0] = "home";
slides[1] = "about";
slides[2] = "working";
slides[3] = "services";
slides[4] = "who";
slides[5] = "new";
slides[6] = "contact";
if( window.location.hash != '' ) {
anchor = window.location.hash;
if( $.inArray(anchor, slides) ) {
startHere = key;
}
}
Thanks in advance for any advice, K...
No comments:
Post a Comment