第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

給每一個(gè)頁(yè)面的li的寬度不是應(yīng)該等于容器寬度嗎?

//設(shè)置每一個(gè)頁(yè)面li的寬度

? ? ? ? $.each(slides, function(index) {

? ? ? ? ? ? var slide = slides.eq(index); //獲取到每一個(gè)li元素 ? ?

? ? ? ? ? ? slides.css({

? ? ? ? ? ? ? ?width: width+'px',

? ? ? ? ? ? ? ?height: height+'px'

? ? ? ? ? ? });

? ? ? ? })

為什么li寬度要等于ul寬度呢?= =代碼錯(cuò)了吧?

正在回答

2 回答

<!DOCTYPE?html>
<html>

<head>
????<meta?http-equiv="Content-type"?content="text/html;?charset=utf-8"?/>
????<title>慕課七夕主題</title>
????<script?src="http://img1.sycdn.imooc.com//down/55ac9a860001a6c500000000.js"></script>
????<style?type="text/css">
????*?{
????????padding:?0;
????????margin:?0;
????}

????ol,
????ul,
????li?{
????????list-style-type:?none;
????}
????/*主體部分*/
????#content?{
????????width????:?60%;
????????height???:?60%;
????????top??????:?20%;
????????left?????:?20%;
????????overflow?:?hidden;
????????position?:?absolute;
????????border???:?1px?solid?#ccc;
????}
????
????.content-wrap?{
????????position:?relative;
????}
????.content-wrap?>?li?{
????????width:?100%;
????????height:?100%;
????????background:?#CAE1FF;
????????color:?red;
????????float:?left;
????????overflow:?hidden;
????????position:?relative;
????}
????li:nth-child(2)?{
???????background:?#9BCD9B;
????}
???
????li:nth-child(3)?{
???????background:?yellow;
????}
????
????</style>
</head>

<body>
????<div?id='content'>
????????<ul?class='content-wrap'>
????????????<!--?第一副畫面?-->
????????????<li>?頁(yè)面1?</li>
????????????<!--?第二副畫面?-->
????????????<li>?頁(yè)面2?</li>
????????????<!--?第三副畫面?-->
????????????<li>?頁(yè)面3?</li>
????????</ul>
????</div>
????<script?type="text/javascript">
????????var?container?=?$("#content");
????????//獲取第一個(gè)子節(jié)點(diǎn)
????????var?element?=?container.find(":first")
????????//li頁(yè)面數(shù)量
????????var?slides?=?element.find("li")
????????//獲取容器尺寸
????????function?change(){
????????????var?width?=?container.width();
????????????var?height?=?container.height();
????????????//設(shè)置li頁(yè)面總寬度
????????????element.css({
????????????????width??:?(slides.length?*?width)?+?'px',
????????????????height?:?height?+?'px'
????????????})
????????????//設(shè)置每一個(gè)頁(yè)面li的寬度
????????????$.each(slides,?function(index)?{
????????????????var?slide?=?slides.eq(index);?//獲取到每一個(gè)li元素????
????????????????slides.css({
???????????????????width:?width+'px',
???????????????????height:?height+'px'
????????????????});
????????????})
????????}
????????change();
????????window.onresize?=?function(){
????????????change();
????????}
????</script>
</body>

</html>


0 回復(fù) 有任何疑惑可以回復(fù)我~

父容器是ul吧。。

1 回復(fù) 有任何疑惑可以回復(fù)我~
#1

arlenhui 提問(wèn)者

一、我沒(méi)說(shuō)父元素 二、請(qǐng)理解contain和contain-wrap的意思 三、你的回答為什么對(duì)我的問(wèn)題毫無(wú)幫助= =
2015-08-06 回復(fù) 有任何疑惑可以回復(fù)我~
#2

arlenhui 提問(wèn)者

語(yǔ)死早,我昨晚就看到這個(gè)章節(jié)就去睡了,下一章代碼和這一章不同,看來(lái)是這一章代碼錯(cuò)了
2015-08-06 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

給每一個(gè)頁(yè)面的li的寬度不是應(yīng)該等于容器寬度嗎?

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)