简体   繁体   中英

Adding multiple box-shadows in JQuery

My question is rather simple, I'm attempting to draw a map with several colored cells in it. Since I don't want to clutter my page with hundreds of div cell, I want to make a single div and then paint on it "manually" by using several box-shadows .

However, I need to modify them dynamically, and so I try using

$("#mapid").css("box-shadow", "my_shadow_data");

And it turns out that JQuery only takes a single argument; I can't make several box-shadows by separating them with a comma.

Thanks for your time!

You can always pass an object inside your css (...). Take a look at my example. Hope it helps!

 $(document).ready(function(){ $("#mapid").css({ "color":"white", "backgroundColor": "red" }); }); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <div id = "mapid">hello</div> 

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