jquery - Return to iFrame instead of parent on closing Fancybox -
i have iframe that's rendered inside fancybox. within iframe have link calls fancybox on parent page suggested here. working desired. on closing fancybox called within iframe using fancybox on parent page, return parent page. however, behavior modified return iframe instead of parent page.
the fancybox have in iframe:
jquery('.container').on('click', 'a.fancybox-large', function(e){ e.preventdefault(); parent.jquery.fancybox({ href : this.href, padding : 0, closebtn : true, fittoview : true, helpers : { overlay: {opacity: 1, css: {'background-color': '#000000'}} } }); }); any suggestion?
regards, john
you can select element inside of iframe want focus on using .focus() method.
so having input field inside iframe instance
<input type="text" class="field" /> edited: add full script.
add script afterclose option
jquery('.container').on('click', 'a.fancybox-large', function(e){ e.preventdefault(); parent.jquery.fancybox({ href : this.href, padding : 0, closebtn : true, fittoview : true, helpers : { overlay: { opacity: 1, css: {'background-color': '#000000'} } }, afterclose: function(){ jquery('.input').focus(); } }); }); // on and focus on input field inside iframe after fancybox closed
Comments
Post a Comment