[英]How to add z-index via object?
$("<div>").css({
zIndex: 123
}).appendTo("body");
or 要么
$("<div>").css({
"z-index": 123
}).appendTo("body");
.css()
doc : .css()
文件 :
... Also, jQuery can equally interpret the CSS and DOM formatting of multiple-word properties.
...此外,jQuery可以同等地解释多词属性的CSS和DOM格式。 For example, jQuery understands and returns the correct value for both
.css({'background-color': ...})
and.css({backgroundColor: ...})
.例如,jQuery理解并返回
.css({'background-color': ...})
和.css({backgroundColor: ...})
的正确值。
jQuery('div').css('z-index',1000);
yes but you have to use apostrophes/quotation 'z-index
marks: 是的,但是您必须使用撇号/引号
'z-index
标记:
jQuery('<div/>').css({
"z-index": 1000,
opacity: 0.7,
width: jQuery(window).width(),
height: jQuery(document).height(),
top:0,
left:0,
position: 'absolute'}).appendTo('body');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.