Reputation: 3484
I'm trying to call colorbox close() function from the iframe. This is what I have.
Main page
<script>
$(document).ready(function(){
$("#click").colorbox({width:"60%",
height:"60%",
iframe:true
});
});
</script>
<a href="login.html" id="click">Click Me!</a>
Login.html
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="jquery.colorbox.js"></script>
<script>
$(document).ready(function(){
setTimeout(function() {
parent.jQuery.fn.colorbox.close();
}, 3000);
});
</script>
</head><body></body>
</html>
I'm getting this error when settimeout is called.
Uncaught TypeError: Cannot read property 'fn' of undefined
I tried to follow the answer in this thread. how to close colorbox within iframe?
Upvotes: 1
Views: 1811