How to create a url to open a page using the jQuery lightbox plugin color window?

I am using the jQuery lightbox colorbox plugin ( http://colorpowered.com/colorbox/ ) and I want to be able to create a url like www.example. com / about-me.html, which will send the user to my site and open the iframed page (about-me.html) in the lightbox script.

I believe that I need to use event hooks or something like that, but I'm not sure how to achieve the result. Any help was appreciated.

+3
source share
3 answers

The loan goes to Jack Moore in google colorbox group.

:

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

}

, URL- : www.example.com?about-me. , javascript colorbox, .

google : http://groups.google.com/

+4

edit -

, , , , window.load dom ready, :

$(document).ready(function () {
   if(document.location.hash){
    //launch colorbox and use this hash
    $.fn.colorbox({width:"50%", inline:true, href:""+document.location.hash+""});
   }
});
+1

, . , iframe. , :

( )

$(".iframe").colorbox({iframe:true});

<p><a class='iframe' href="http://google.com">Outside webpage (IFrame)</a></p>

: , URL- - , URL- . , url iframe , , - .

http://www.example.com/main?load=about.htm

- MVC, :

http://www.example.com/main/about

. , , about.htm iframe.

0

Source: https://habr.com/ru/post/1716969/


All Articles