在悬停或点击时显示存储在表格 `` 中的信息。

huangapple go评论61阅读模式
英文:

Show info stored in table td on hover or click

问题

以下是已翻译的内容:

$'.shippingrates td'.hoverfunction(){
    $this.attr'data-id';
};
英文:

What would be the easiest way to show info stored in each table cell data-id on hover or click (mobile device). I'm not sure how it works on mobile devices.

http://jsfiddle.net/p134uhev/

$('.shippingrates td').hover(function() {
        $(this).attr('data-id');
    });

答案1

得分: 1

一个实现“hover”对话框的简单方法是使用Bootstrap的“popover”库。

https://getbootstrap.com/docs/4.0/components/popovers/

JS

$(function () {
    $('[data-toggle="popover"]').popover()
});

HTML

<button type="button" class="btn btn-secondary" data-container="body" data-toggle="popover" data-placement="bottom" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus.">底部弹出框</button>
英文:

An easy way to implement hover dialogs would be to use the bootstrap popover library.

https://getbootstrap.com/docs/4.0/components/popovers/

JS

$(function () {
    $(&#39;[data-toggle=&quot;popover&quot;]&#39;).popover()
});

HTML

&lt;button type=&quot;button&quot; class=&quot;btn btn-secondary&quot; data-container=&quot;body&quot; data-toggle=&quot;popover&quot; data-placement=&quot;bottom&quot; data-content=&quot;Vivamus sagittis lacus vel augue laoreet rutrum faucibus.&quot;&gt;Popover on bottom&lt;/button&gt;

huangapple
  • 本文由 发表于 2020年1月3日 17:09:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/59575742.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定