怎么办我设置fancybox minHeight和maxHeight?

时间:2018-05-28 07:55:32

标签: jquery fancybox fancybox-2 fancyimpute fancyupload

fancybox版本:2.1.0

描述:我不想升级到版本3,因为它会影响其他版本。

那么minHeightmaxHeight值如何在当前版本中有效?

我尝试了以下方法,但它没有用。

//source code

$.fancybox.open({
            href: '#advancedSearchWrapper',
            maxHeight: 500,
            minHeight: 300,
            fitToView: true,
            autoSize: true,
            modal: true,
            autoScale: true,
)}

1 个答案:

答案 0 :(得分:-1)

要使minHeightmaxHeight选项生效,您需要将autoSize选项设置为false



$.fancybox.open({
  href: '#divContent',
  maxHeight: 150,
  minHeight: 100,
  fitToView: true,
  autoSize: false,
  modal: true,
  autoScale: true,
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fancybox@2.1.7/dist/css/jquery.fancybox.css" type="text/css" media="screen" />
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/fancybox@2.1.7/dist/js/jquery.fancybox.pack.js"></script>

<div id="divContent">
  Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content
  Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content...
</div>
&#13;
&#13;
&#13;