问题
Please see here for example: ( banners > dizzee rascal > see more+ ) http://www.ok-hybrid.com/store/wip/index.html
As they are flicked through, I'd like each banner to show at the correct size. As is, they are all showing at 728x90 - the dimensions of the 1st banner in the gallery.
I've used:
$("a.fancybox_swf").each(function(){
var $a = $(this);
var h = $a.data("height")
var w = $a.data("width");
$a.fancybox({
'width' : w,
'height': h
and for the individual items:
<a class="fancybox_swf" data-width="728" data-height="90" href="swf/dizcash_728x90.swf" rel="diztong">+</a>
<a class="fancybox_swf" data-width="300" data-height="250" href="swf/dizcash_300x250.swf" rel="diztong">+</a>
<a class="fancybox_swf" data-width="728" data-height="90" href="swf/dizholiday_728x90.swf" rel="diztong">+</a>
<a class="fancybox_swf" data-width="300" data-height="250" href="swf/dizholiday_300x250.swf" rel="diztong">+</a>
Thanks for looking. Any help appreciated. P.
回答1:
Just use a normal fancybox custom script and get the width
and height
with the afterLoad
option like:
$("a.fancybox_swf").fancybox({
fitToView: false,
afterLoad: function(){
this.width = $(this.element).data("width");
this.height = $(this.element).data("height");
}
}); // fancybox
来源:https://stackoverflow.com/questions/9052081/fancybox-swf-gallery-not-resizing-between-items