开发者

hard link a Rel in the URL

Is it possible to make a link such that it brings up the REL of a topic,

for example if a link is

开发者_运维技巧
<a href="picture.jpg" rel="lightbox">Click here</a>

Is it possible to have a user link so when they go to the page it automatically opens the lightbox?

For example http://example.com/?rel=lightbox&src=picture.jpg

or something like that?


Yes, but no browsers include a lightbox, so you'd need to write or find code to make one of those as well.


Yes, it is possible. You may better use URLs like http://domain.com/#lightbox, and write a little script:

//jQuery sample
$(document).ready(function() { 
     if (location.hash == "#lightbox") {
          //Just show your lightbox manually
     }
});


you can do that with a bit of jQuery

$(a[rel=lightbox]).click(function(e) {
  // open the lightbox with the link url inside
  return false
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜