html - 当我们悬停在表格行上时弹出数据

标签 html css twitter-bootstrap

我正在尝试显示一个弹出窗口,其中包含表格行中的数据,如 URL (CS WHOLESALE GROCERS) 中显示的图像。

https://lh6.googleusercontent.com/IhrfCsZ55PsmaxVpT8N1TIep-92eSZb5lWRx11WrVzS55CNwybtARfFIaMIXbUKd5LS1T1hOL1LVsEtRkuyazpNP_dI=w1342-h519

我在我的 Controller 中添加了以下angularjs代码

app.directive('tooltip', function(){
    return {
        restrict: 'A',
        link: function(scope, element, attrs){
            $(element).hover(function(){
                // on mouseenter
                $(element).tooltip('show');
            }, function(){
                // on mouseleave
                $(element).tooltip('hide');
            });
        }
    };
});

并将其添加到我的 html 中。

<div class="col-sm-2 tabularData" data-toggle="tooltip" data-placement="bottom">
                            <dl class="dl-horizontal">
                                <dt>Status</dt>
                                <dd>{{bookingData.status}}</dd>
                                <dt>Trade</dt>
                                <dd>{{bookingData.trade}}</dd>
                                <dt>{{customerOrBooking}}</dt>
                                <dd>{{bookingData.bookingCsr}}</dd>
                                <dt>L/D Svc</dt>
                                <dd>{{bookingData.serviceType}}</dd>

                            </dl>
                        </div>

但我没有得到图像中的输出。

最佳答案

调用这个jquery:

$(function () {
   $('.subitem').attr('title', $('.statusRollup').remove().html())
   $(document).tooltip();
});

现在更改您的 Div

<div class="item">
<div class="subitem col-sm-2 tabularData" data-toggle="tooltip" data-placement="bottom">Hello</div>    
</div>

 <dl class="statusRollup dl-horizontal">
      <dt>Status</dt>
                                <dd>{{bookingData.status}}</dd>
                                <dt>Trade</dt>
                                <dd>{{bookingData.trade}}</dd>
                                <dt>{{customerOrBooking}}</dt>
                                <dd>{{bookingData.bookingCsr}}</dd>
                                <dt>L/D Svc</dt>
                                <dd>{{bookingData.serviceType}}</dd>
 </dl>

关于html - 当我们悬停在表格行上时弹出数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32713012/

相关文章:

twitter-bootstrap - 水平形式 - 设置控件标签宽度的最佳方法?

javascript - 如何以选项卡形式发送多个单选按钮值

javascript - 输入时读取登录凭据中的计时器的辅助功能 (ADA) 问题

javascript - 具有固定线宽的响应式 Canvas

html - 三列 HTML flexbox : how to set the middle one to get all the remaining space?

javascript - Bootstrap javascript 事件未绑定(bind)

javascript - 使用 "slideToggle"查看 <div> [ jQuery ]

html - 将 HTML 页面分成 5 个部分

css - 列表样式类型无不起作用

twitter-bootstrap - Bootstrap 4 中的 .btn-default 去了哪里?