简体   繁体   English

如何调整JavaScript小部件的大小?

[英]How do I resize a javascript widget?

I need to insert this javascript widget on my website. 我需要在我的网站上插入此javascript小部件。 The fact is if I insert this script on the website, the height is too big and there is a lot of "wasted" space. 事实是,如果我在网站上插入此脚本,则高度太大,并且有很多“浪费”的空间。 I was wondering if I could resize it to an height of 215px. 我想知道是否可以将其调整为215px的高度。

I have tried to include it in a div or iframe, but my attempts were unsuccessful. 我尝试将其包含在div或iframe中,但尝试失败。 Is there a quick way to do it? 有快速的方法吗?

Thanks 谢谢

<script src="https://next.fatsoma.com/widgets/scripts/events.js" data-reference="1b98e59f-5e65-42ef-bf8c-e2c389ebbb54"></script>

Fixed it for you, Wrap it inside a div, specify a height and set overflow: hidden; 为您修复了此问题,将其包装在div中,指定了高度并设置了溢出:

height: 215px;
overflow: hidden;

JSFiddle demo JSFiddle演示

Using the same technique Paradoxis did with a div wrapped around your widget which is an iFrame you can do this in css if you have the following: 使用Paradoxis使用相同的技术,将div包裹在小部件(即iFrame)周围,如果您具有以下条件,则可以在CSS中执行此操作:

    <div class="test">
       <script src="https://next.fatsoma.com/widgets/scripts/events.js" data-reference="1b98e59f-5e65-42ef-bf8c-e2c389ebbb54"></script>
    </div>

You can do this in your css: 您可以在CSS中执行以下操作:

    div.test iFrame {
        width:215px!important; //!important is used because the width is set inline on the iframe
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM