Javascript 使用20px'定位引导弹出框;保证金';窗边

Javascript 使用20px'定位引导弹出框;保证金';窗边,javascript,twitter-bootstrap,popover,bootstrap-popover,Javascript,Twitter Bootstrap,Popover,Bootstrap Popover,有人问我是否可以让我们的引导弹出框避开左右两侧的窗口边缘。我一直在阅读引导站点、tether站点等等。 …但到目前为止,还没有找到可以设置窗口左右边缘的最小像素距离的方法。 我试图获取OpenPopover的.css('left')值,但得到的只是“未定义” 我有一个带有onclick属性的链接,它指向以下函数(除了定位问题之外,它还正确初始化了popover) 功能电子邮件证书单击(e){ var emailLink=$(e); var attemptId=$(emailLink).attr

有人问我是否可以让我们的引导弹出框避开左右两侧的窗口边缘。我一直在阅读引导站点、tether站点等等。

…但到目前为止,还没有找到可以设置窗口左右边缘的最小像素距离的方法。
我试图获取OpenPopover的.css('left')值,但得到的只是“未定义”

我有一个带有onclick属性的链接,它指向以下函数(除了定位问题之外,它还正确初始化了popover)

功能电子邮件证书单击(e){
var emailLink=$(e);
var attemptId=$(emailLink).attr(“数据尝试id”);
var url=“/CL/MyTraining/EmailCertificate/?attemptId=“+attemptId;
$.get(url、函数(数据){
var popover=emailLink.data('bs.popover');
如果(数据和数据结果==“成功”){
popover.options.title='';
popover.options.title+='';
popover.options.title+='';
popover.options.title+='';
popover.options.title+='';
popover.options.title+=CertificateSentSuccessfullytle;
popover.options.title+='';
popover.options.title+='';
popover.options.content=certificateSentSuccessfullyMessage+“”+data.Email+“”;
}
否则{
popover.options.title='';
popover.options.title+='';
popover.options.title+='';
popover.options.title+='';
popover.options.title+='';
popover.options.title+=certificateEmailFailedTitle;
popover.options.title+='';
popover.options.title+='';
popover.options.content=certificateEmailFailedMessage;
}
popover.show();
var$popover=$('.my training Certificate.popover');
console.log(“$popover=“+$popover”);//[object]
var popoverXPosition=$popover.css('left');
console.log(“popoverXPosition=“+popooverxposition);//未定义
});
返回false;
}
检查dev工具中的openpopover,我可以看到popover确实将css('left')设置为'-165px'。我一直无法找到这是如何或在哪里设置的

是否有一种最佳实践、非解决方法来防止引导弹出窗口接触窗口边缘?干杯

function emailCertificateClick(e) {
    var emailLink = $(e);
    var attemptId = $(emailLink).attr("data-attempt-id");
    var url = "/CL/MyTraining/EmailCertificate/?attemptId=" + attemptId;
    $.get(url, function (data) {

        var popover = emailLink.data('bs.popover');

        if (data && data.Result == "Success") {
            popover.options.title = '<div class="certificate-email-success-popover-title">';
            popover.options.title += '<span class="fa fa-check">';
            popover.options.title += '<svg>';
            popover.options.title += '<use xlink:href="/Areas/CL/Content/app/images/icons/icon-svg-defs.svg#fa-check"></use>';
            popover.options.title += '</svg>';
            popover.options.title += certificateSentSuccessfullyTitle;
            popover.options.title += '</span>';
            popover.options.title += '</div >';
            popover.options.content = certificateSentSuccessfullyMessage + ' <b>' + data.Email + '</b>';
        }
        else {
            popover.options.title = '<div class="certificate-email-error-popover-title">';
            popover.options.title += '<span class="fa fa-times">';
            popover.options.title += '<svg>';
            popover.options.title += '<use xlink:href="/Areas/CL/Content/app/images/icons/icon-svg-defs.svg#fa-times"></use>';
            popover.options.title += '</svg>';
            popover.options.title += certificateEmailFailedTitle;
            popover.options.title += '</span>';
            popover.options.title += '</div >';
            popover.options.content = certificateEmailFailedMessage;
        }

        popover.show();
        var $popover = $('.my-training-certficate .popover'); 
        console.log("$popover = " + $popover); // [object Object]
        var popoverXPosition = $popover.css('left');
        console.log("popoverXPosition = " + popoverXPosition); // undefined       
    });

    return false;
}