How to construct a URL to open a page with jquery lightbox plugin colorbox?

前端 未结 3 805
故里飘歌
故里飘歌 2021-01-03 10:40

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 th

3条回答
  •  爱一瞬间的悲伤
    2021-01-03 11:15

    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();
    
    }
    

    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.

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

提交回复
热议问题