简体   繁体   English

如何使用JQuery覆盖CSS

[英]How to override the css using the JQuery

i am trying to override the inline style of JQuery dialog using JQuery , but i am not getting reflection in the program. 我试图使用JQuery覆盖JQuery对话框的内联样式,但是我没有在程序中得到反映。 I want to position the jquery dialog box to some position. 我想将jquery对话框定位到某个位置。 I tried overriding the css style, but it didn't work. 我尝试覆盖CSS样式,但没有用。

now i am trying to override using css.but it is also not working.. 现在我正在尝试使用css ..但它也无法正常工作..

How can i do this please suggest. 我该怎么做,请提出建议。

i want to override this below css using JQuery css code: 我想使用JQuery CSS代码在CSS下面覆盖此代码:

.ui-dialog{
    display: block;
    height: auto;
    left: 858px;
    position: absolute;
    top: 124px;
    width: 235px;
}

JQuery code: jQuery代码:

$(".ui-dialog").css('position', 'absolute', 'left', '858px');

How can i do this? 我怎样才能做到这一点?

$(".ui-dialog").css({'position': 'absolute', 'left': '858px'});

编辑:如果要使用CSS进行此操作,而不是动态地计算左位置,则可以使用dialogClass为对话框提供标识符,然后使用dialog类并将相同的CSS规则放在样式表中。

Try this: 尝试这个:

$(".ui-dialog").css('position', 'absolute');
$(".ui-dialog").css('left', '858px');

Then read up on jQuery .css() . 然后阅读jQuery .css()

As far as I can understand you that you are likely to do set the position and left value and remove all others Then do the followings: 据我了解,您可能会设置位置和左值并删除所有其他值,然后执行以下操作:

First remove the style: 首先删除样式:

$(".ui-dialog").attr('style',' ');

Then attach this style 然后附上这种风格

$(".ui-dialog").css({'position':'absolute', 'left': '858px'});
$(".ui-dialog").css({position:'absolute',left:'858px'});

Try to call in this way.. 尝试用这种方式打电话。

$( ".ui-dialog" ).css({ 'position': 'absolute', 'left': '858px' }); $(“ .ui-dialog”).css({'position':'absolute','left':'858px'});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM