努力之后,我终于决定问。
我在弹出窗口中有html内容,有一个固定的按钮可以触发弹出窗口,但是,滚动窗口时,弹出窗口不会停留在滚动按钮上。我在下面尝试过
$('.rbtn').popover({
html : true,
container: 'body',
template: $('.popover').html(),
content: function() {
$('.scrollbar').show();
return $('.scrollbar').html();
},
container: 'body'
});
$('.rbtn').on('shown.bs.popover', function () {
$('.bs-popover-left').css({"top":"10vh"});
});
我可以在dom中看到这个bs-popover-left类别,当显示popover时也可以使用。所以我尝试在滚动上做同样的事情。
$( window ).scroll(function() {
setTimeout(function(){
console.log($('.bs-popover-left').css("top"));
$('.bs-popover-left').css({"top":"10vh"});
},500);
});
这是行不通的。 我的目的是将弹出窗口保持在最先弹出的位置,并且在滚动时不更改其位置。 任何帮助将不胜感激。