Reputation: 1125
I've a loader overlay showing when I click on an ajax fancybox. But there is always a fancybox class added to it.
Here is the fiddle.
<div class="loading hide">Loading…</div>
<a class="fancybox fancybox.ajax" href="http://fancyapps.com/fancybox/demo/1_b.jpg">
click me
</a>
$('.fancybox').fancybox({
beforeLoad: function () {
$('.loading').removeClass('hide');
},
beforeShow: function () {
$('.loading').addClass('hide');
}
});
When you click on the link, show source on the result, there is a fancybox-margin
added.
This class is only added when the .loading
element has the position:fixed
Is there a way I can tell fancybox to not add this class?
Upvotes: 1
Views: 1104
Reputation: 41143
You don't need to hack the original fancybox js file. If you do so, you will have to do it again the day you update a new version.
Just add to you custom fancybox initialization script the option
helpers: {
overlay: {
locked: false
}
}
and the class fancybox-margin
won't be added
Upvotes: 2
Reputation: 23989
You can look at the Fancybox code and comment out the following:
if (this.margin !== false) {
$('*').filter(function(){
return ($(this).css('position') === 'fixed' && !$(this).hasClass("fancybox-overlay") && !$(this).hasClass("fancybox-wrap") );
}).addClass('fancybox-margin');
this.el.addClass('fancybox-margin');
}
But beware dragons - I have no idea what effect this will have on the placement of the popup.
You'd probably be better having a look at the css file and playing with inspector to see what this does though first.
Upvotes: 0
Reputation: 2495
Only by modifying source. Remove these lines (1833-1835):
$('*').filter(function(){
return ($(this).css('position') === 'fixed' && !$(this).hasClass("fancybox-overlay") && !$(this).hasClass("fancybox-wrap") );
}).addClass('fancybox-margin');
Upvotes: 1