課程
/前端開發(fā)
/JavaScript
/展開與收起效果
求最后問題的解答
2014-12-31
源自:展開與收起效果 6-1
正在回答
var prevContent=null;var prevAbstract=null;function showdiv(obj) {....? if (prevContent!=null) {prevContent.style.display = "none";prevAbstract.style.display = "block";}? x.style.display="block"; obj.parentNode.style.display = "none"; ? prevContent=x;prevAbstract = obj.parentNode;}
/** * Created by Administrator on 2016-09-04. */function showdiv(obj){ ? ?initstatus(); ? ?var x = obj.parentNode;//摘要 ? ?//var y = x.nextSibling;//正文 ? ?var y = IceNextSiblingNode(x.nextSibling); ? ?x.style.display = 'none'; ? ?y.style.display = 'block';}function ?hidediv(obj){ ? ?var x = obj.parentNode.parentNode;//正文的容器 ? ?//var y = x.nextSibling;//正文 ? ?var y = IcePreviousSiblingNode(x.previousSibling); ? ?x.style.display = 'none'; ? ?y.style.display = 'block';}function IceNextSiblingNode(obj){ ? ?while (obj.nodeType != 1 ){ ? ? ? ?obj = obj.nextSibling; ? ?} ? ?return obj;}function IcePreviousSiblingNode(obj){ ? ?while(obj.nodeType !=1 ){ ? ? ? ?obj = obj.previousSibling; ? ?} ? ?return obj;}function initstatus(){ ? ?var contentList = document.querySelectorAll(".content"); ? ?var abstractList = document.querySelectorAll(".abstract"); ? ?for(var i=0; i<contentList.length; i++){ ? ? ? ?contentList[i].style.display = 'none';//隱藏所有文章的內(nèi)容 ? ? ? ?//abstractList[i].style.display = 'block'; ? ? ? ?IcePreviousSiblingNode(contentList[i].previousSibling).style.display = 'block'//顯示 全文按鈕 ? ?}}
哪個問題?(煩請?zhí)釂栒甙褑栴}寫清楚)
舉報
通過效果展示與案例分析,教您實(shí)現(xiàn)不同類型的展開與收起效果
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2018-03-27
var prevContent=null;
var prevAbstract=null;
function showdiv(obj) {....
? if (prevContent!=null) {prevContent.style.display = "none";prevAbstract.style.display = "block";}
? x.style.display="block"; obj.parentNode.style.display = "none";
? prevContent=x;prevAbstract = obj.parentNode;}
2016-11-22
/**
* Created by Administrator on 2016-09-04.
*/
function showdiv(obj){
? ?initstatus();
? ?var x = obj.parentNode;//摘要
? ?//var y = x.nextSibling;//正文
? ?var y = IceNextSiblingNode(x.nextSibling);
? ?x.style.display = 'none';
? ?y.style.display = 'block';
}
function ?hidediv(obj){
? ?var x = obj.parentNode.parentNode;//正文的容器
? ?//var y = x.nextSibling;//正文
? ?var y = IcePreviousSiblingNode(x.previousSibling);
? ?x.style.display = 'none';
? ?y.style.display = 'block';
}
function IceNextSiblingNode(obj){
? ?while (obj.nodeType != 1 ){
? ? ? ?obj = obj.nextSibling;
? ?}
? ?return obj;
}
function IcePreviousSiblingNode(obj){
? ?while(obj.nodeType !=1 ){
? ? ? ?obj = obj.previousSibling;
? ?}
? ?return obj;
}
function initstatus(){
? ?var contentList = document.querySelectorAll(".content");
? ?var abstractList = document.querySelectorAll(".abstract");
? ?for(var i=0; i<contentList.length; i++){
? ? ? ?contentList[i].style.display = 'none';//隱藏所有文章的內(nèi)容
? ? ? ?//abstractList[i].style.display = 'block';
? ? ? ?IcePreviousSiblingNode(contentList[i].previousSibling).style.display = 'block'//顯示 全文按鈕
? ?}
}
2016-01-19
哪個問題?(煩請?zhí)釂栒甙褑栴}寫清楚)