Open ColorBox from iFrame to Parent Window


Hits: 5879  

function iframecode(url, w, h) {
window.parent.$.colorbox({href:url, iframe: true, scrolling: false, width: w, height: h});

}

var headID = window.parent.document.getElementsByTagName("head")[0];         
var newScript = window.parent.document.createElement('script');
newScript.type = 'text/javascript';
newScript.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js';
headID.appendChild(newScript);

var headID = window.parent.document.getElementsByTagName("head")[0];         
var cssNode = window.parent.document.createElement('link');
cssNode.type = 'text/css';
cssNode.rel = 'stylesheet';
cssNode.href = 'http://demo.svnlabs.com/colorbox/example3/colorbox.css';
cssNode.media = 'screen';
headID.appendChild(cssNode);

var headID = window.parent.document.getElementsByTagName("head")[0];         
var newScript = window.parent.document.createElement('script');
newScript.type = 'text/javascript';
newScript.src = 'http://demo.svnlabs.com/colorbox/colorbox/jquery.colorbox.js';
headID.appendChild(newScript);

Uses:
onClick=”iframecode(‘http://www.svnlabs.com/’, ‘80%’, ‘80%’);”

Bookmark and Share

Published by

Sandeep Verma

I’m an Entrepreneur. I’m proud to work as Blogger, LAMP Programmer, Linux Admin, Web Consultant, Cloud Manager, Apps Developer, Searcher. Concentrate > Observe > Imagine > Launch

  • qinglong

    Hi any ideas how to make the colorbox scrollable? Have been trying out for quite a while