开发者

Fancybox autodimensions

开发者 https://www.devze.com 2023-04-13 02:43 出处:网络
I am currently trying to implement fancybox. I want to set it to autodimensions but I am having bug every first load.

I am currently trying to implement fancybox. I want to set it to autodimensions but I am having bug every first load.

$.fancybox({

       'autoScale'          : true,
       'autoDimensions'    : true,                
       'content'           : html
});

During first load(first click executing on a newly opened browser) the fancybox width and height are not correct but when I try again(click using the opened browser), the fancybox is displaying my desired output. I'm guessing it can't identify the width and height.

The api says autodimensions

For inline and ajax views, resizes the view to the element recieves. Make sure it has dimensions otherwise th开发者_Python百科is will give unexpected results

I want to know exactly what 'dimensions' mean... maybe that's why my fancybox is buggy.

I appreciate any help... Thank you!


dimensions means that the element you are "fancy-boxing" needs to have width and height set, because fancybox will size itself to whatever your content is sized to already.

Also, the problem may be that fancybox is loading before your content does. Try putting the fancybox javascript code at the bottom of your page, just before the tag.


In your code you have forgot "," after autoscale:true place it and you will get it working.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号