更改.popover-user-notifications样式不起作用?

时间:2018-10-24 11:59:03

标签: jquery whmcs

此代码似乎无效!

$(function()$('.popover-user-notifications').attr('style','left:1194'));

我想更改此div样式的左侧值!

<div class="popover popover-user-notifications fade bottom in" role="tooltip" id="popover104120" style="top: 93px; left: 1593px; display: block;"></div>

enter image description here

1 个答案:

答案 0 :(得分:0)

缺少大括号{}。包装功能需要这些。

尝试:

$(function(){$('.popover-user-notifications').attr('style','left:1194')});

我建议使用.css()方法,而不要更改style属性:

$(function(){$('.popover-user-notifications').css('left','1194')});