closing a colorbox.js window in javascript
I used colorbox.js in my php page to show the list of items the user has chosen; i added a save button in the bottom of the page; i want to close the colorbox window after saving the info;
I tried the following:
$.fn.colorbox.close();
$(".example5").colorbox.close();
i get the colorbox is undefined;
h开发者_运维百科ere's my code:
prList.php:
<link media="screen" rel="stylesheet" href="colorbox.css" />
<script src="jquery.min.js"></script>
<script src="js/jquery.colorbox.js"></script>
<script>
$(document).ready(function(){
$(".example5").colorbox();
$("#click").click(function(){
$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Testtesttest.");
return false;
});
});
</script>
<body>
<div id="listDetails">
<p><a href="form.php?prodId=<?php echo $roow[0]; ?> class="example5">ViewTable</a></p>
</div>
</body>
Form.php:
<table cellpadding="0" cellspacing="0" width="100%" style="border:1" >
<tr class="catH">
<td>aa</td>
<td>bb</td>
<td>cc</td>
</tr>
<tr>
<td colspan="3">
<div align="center" style="height:20px;">
<a href="#" style="color:#000000;" id="cboxSave" class="lbAction" rel="deactivate" onclick="savePurchase();">Save </a>
</div>
</td>
</tr>
</table>
savePurchase():
function savePurchase(){
....................
$.fn.colorbox.close();
}
Can anyone tell me why it's not working?
Reading the docs helps:
$.colorbox.close()
See the following FAQ entry:
http://colorpowered.com/colorbox/#jquery
It sounds like you are d. If you are trying to call that from within an iframe, you should be using the following format:
parent.jQuery.colorbox.close();
精彩评论