fancybox版本:2.1.0
描述:我不想升级到版本3,因为它会影响其他版本。
那么minHeight
和maxHeight
值如何在当前版本中有效?
我尝试了以下方法,但它没有用。
//source code
$.fancybox.open({
href: '#advancedSearchWrapper',
maxHeight: 500,
minHeight: 300,
fitToView: true,
autoSize: true,
modal: true,
autoScale: true,
)}
答案 0 :(得分:-1)
要使minHeight
和maxHeight
选项生效,您需要将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;