tags:

views:

13

answers:

2

Hello,

let say i pass url, example.php?mode=select&ID=1#age

is it possible to add jquery fadeIn based on url?

this url will be on another page, when user click it, a page will load and hence the age filed should be fade in.

if this not possible, is there any other way?

+2  A: 

You can check for the if there's a location.hash set on document.ready and if so, call .fadeIn() on that element, like this:

$(function() {
  if(location.hash) $(location.hash).fadeIn();
});

So for example if your URL was ....#age, this would fade in the id="age" element.

Nick Craver
A: 

I've done something similiar with a URL like this:

http://site.com/page/view/#219

var theHash = window.location.hash;
theHash=theHash.substr(1);

$("#f"+theHash).css('backgroundColor',"#E47527");
$("#f"+theHash).animate({backgroundColor: "#ffefe3" }, 2000);

probably more efficient ways, however. used on links with an ID like "#f111"

Ross