data attribute width + fitToView
Is it possible to set a width using a data attribute while allowing the overlay to still use fitToView?
I have it working in essence but I've noticed my overlays are not responsive/won't scale with the browser unless I remove fitToView from my script?
Here's an example of my 'basic' fancybox: http://codepen.io/moy/pen/YGgjqv
And here is a forked version where I've tried to implement a different width: http://codepen.io/moy/pen/JRzBJp
Do you think it would be easier to set a new fancybox on a different class (like .fancybox-narrow)? I basically want the behaviour to remain the same but due to the content in a couple of overlays I want to display them with a narrower width?
Thanks in advance, hope you can help! :)
I seem to have found a solution to the problem by using the following:
beforeLoad: function() {
if ($(this.element).hasClass('fancybox--small')) {
this.maxWidth = 600;
}
}
Can't see any problems with it (yet). It also means I don't need to adjust the rest of the fancybox rules. Does it seem ok to you?
Thanks again!
That is what callbacks are supposed to do - to manipulate with options, data, content, etc