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

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -