Tuesday, 6 September 2011

Colorbox Tips

Opening colorbox popup using function:

<script>
function lightbox(){    
  $.fn.colorbox({width:"80%", height:"80%", iframe:true, href:"/pagetoopen.html"});
}
</script>
<input type="button" value="open the box" onClick="lightbox()"/>

Modify above function to refresh the parent page when popup closed:

$.fn.colorbox({width:"95%", height:"95%", iframe:true, href:"allocate-contact-number.php?id="+checked_num, onClosed:function(){window.location.reload();}});


Close popup 


<script type="text/javascript" >

self.parent.$.fn.colorbox.close();
</script>





No comments:

Post a Comment