简体   繁体   English

jQuery工具提示图像的高度和宽度

[英]Jquery Tooltip image height & width

I have this tooltip code which works as a charm but I would like to know how do I set max height & width. 我有此工具提示代码,它很吸引人,但我想知道如何设置最大高度和宽度。 Here is my code snippet: 这是我的代码段:

<script type="text/javascript">
    $(document).ready(function () {        
        $('.hoverElement').each(function () {
            var id = $(this).attr('id');
            $(this).tooltip({ content: '<img src="@Url.Action("ShowImage")' + '?email=' + id + '" />' });
        });
    });
</script>

foreach (var item in Model.People)
{
<a class="hoverElement" href="#" title="" id="@item.Email" >@item.Name()</a>
}

Have you tried adding the style inline as you create the element? 在创建元素时,您是否尝试过内联添加样式? Something like this: 像这样:

content: '<img style="max-height:100px;" src="@Url.Action("ShowImage")' + '?email=' + id + '" />'

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

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