jQUery fadeIn based on url?
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开发者_StackOverflow中文版 will load and hence the age filed should be fade in.
if this not possible, is there any other way?
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.
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"
加载中,请稍侯......
精彩评论