简体   繁体   中英

div width with jquery in percent

I try to adapt this code jquery so that the width of my div "book" is in percentage.

<div id="book" class='album'>
d.wowBook.defaults={width:1200,......YES
d.wowBook.defaults={"width:100%",......NO
d.wowBook.defaults={'width:100%',......NO
d.wowBook.defaults={width:"100%",......NO
d.wowBook.defaults={width:100+"%",......NO  

thanks in advance

You can provide width in percentage by using jquery

$(document).ready(function(){
 $("#book").width('40%');
//or
 $("#book").css('width','40%');
});

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