如何构造一个URL以使用jQuery Lightbox插件Colorbox打开页面? [英] How to construct a URL to open a page with jquery lightbox plugin colorbox?

查看:106
本文介绍了如何构造一个URL以使用jQuery Lightbox插件Colorbox打开页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jquery灯箱插件colorbox( http://colorpowered.com/colorbox/)和我希望能够构造一个URL,如www.example.com/about-me.html,它将把用户发送到我的网站,并在灯箱脚本中打开iframed页面(about-me.html).

I am using jquery lightbox plugin colorbox (http://colorpowered.com/colorbox/) and i want to be able to construct a URL like www.example.com/about-me.html which will send the user to my website and open the iframed page (about-me.html) within the lightbox script.

我相信我必须使用事件挂钩或其他方法,但是我不确定如何实现结果.任何帮助表示赞赏.

I believe i have to use event hooks or something but i am not sure how to achieve the result. Any help appreciated.

推荐答案

信用归彩盒Google小组的杰克·摩尔(Jack Moore)

Credit goes to Jack Moore on the colorbox google group.

他的解决方案适合于这个问题:

His solution adapted to this question:

var url = document.location.href;
if(url.search(/\?about-me/i) !== -1){
    $(".iframe:first").click();

}

因此该网址为www.example.com?about-me,它将带用户进入首页,此javascript将找到该参数并告诉colorbox打开它.

So the url would be www.example.com?about-me this would take the user to the homepage and this javascript will find that parameter and tell colorbox to open it.

原始的Google网上论坛线程和更多信息: http://groups.google.com/

Original google group thread and more info: http://groups.google.com/

这篇关于如何构造一个URL以使用jQuery Lightbox插件Colorbox打开页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆