jquery - How to refresh Fancybox content when closed? -
is there way reset fancybox instance or refresh contents of it, when closed? note grabs content div on same page.
i want display content first loaded dom, when re-opening fancybox.
i guess more of javascript/jquery thing, fancybox thing, right?
$.fancybox.open({     href: '#popup',     padding: 0,     autowidth: true,     arrows: false,     closebtn: false,     scrolloutside: true,     helpers: {         overlay: {             css: {                 'background': 'rgba(0, 0, 0, 0.5)'             },             locked: false         }     },     afterclose: function() {         // reset or refresh here     } });      
it depends on sort of changes making target div, not able "reset" them without reloading page, or performing funky ajax call page , getting div contents there. 
the simplest way of getting around store markup of div in variable (using jquery's html(), , "reset" div using variable in afterclose() callback. 
js
var content = $('#popup').html(); // store content on documentready()  $.fancybox.open({     href: '#popup',     padding: 0,     autowidth: true,     arrows: false,     closebtn: false,     scrolloutside: true,     helpers: {         overlay: {             css: {                 'background': 'rgba(0, 0, 0, 0.5)'             },             locked: false         }     },     afterclose: function(){         $('#popup').html(content);     } });       it might best use fancybox's beforeload callback, in conjunction this, of content, seem loading single div, should work.
Comments
Post a Comment