0

我正在使用 Fancybox 2.1.3 在页面加载时显示一些文本。问题是当我希望它全部放在一行时,它会将它包装成两行。我已经尝试过 width、autoSize 和 fitToView 属性,但它们都没有做任何事情。

我不想修改fancybox css 文件,因为我也在使用fancybox 来显示一些图像,并且这些图像工作正常。

Javascript

  <script type='text/javascript'>
     $(document).ready(function(){
        // Activate fancyBox
        $('.text').fancybox({
           padding   : 0,
           closeBtn  : false,
           topRatio  : 0.75,
           helpers : { 
              overlay: {
                 css: {'background' : 'rgba(0, 0, 0, 0.0)'}
              } // overlay 
           } // helpers
        });
        // Launch fancyBox on first element
        $('.text').eq(0).trigger('click');
        // Close automatically
        setTimeout('parent.$.fancybox.close();', 10000);
     });

HTML

<a href='#textid' class='text'></a>
<div style='display: none'>
    <div id='textid'>The display text goes here.</div>
</div>

CSS

#textid
   {
   font-size: 40px;
   color: red;
   }
4

1 回答 1

0
#textid {
  font-size: 40px;
  color: red;
  white-space: nowrap;
}
于 2013-01-28T21:48:10.903 回答