简体   繁体   中英

Z-index not working with jquery css

How is it that this works:

$("#linechart").css({
      position:'fixed',
      top: "4%",
      left: "2%",
      height: "92%",
      width: "96%"
  });

and this breaks all the javascript:

$("#linechart").css({
      position:'fixed',
      top: "4%",
      left: "2%",
      height: "92%",
      width: "96%",
      z-index: "5"
  });

You have to define like this:

"z-index": "5"

Or uppercase if you don't want to define in quotes:

zIndex: "5"

Try this

$("#linechart").css({
      position:'fixed',
      top: "4%",
      left: "2%",
      height: "92%",
      width: "96%",
      'z-index': "5"
});

and reason is when we use css in jQuery we have to write like this if the word has space in between words

您可以看到以下内容:204行的jQuery Source Code

"zIndex": true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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