From d2b6b6ff84fda0e01a424aba600b01efcff5bddf Mon Sep 17 00:00:00 2001 From: lyt Date: Wed, 13 Jan 2021 12:12:39 +0800 Subject: [PATCH] pure JS; expand & collapse MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 选择器修改 --- js/expand-info.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/js/expand-info.js b/js/expand-info.js index 43f9b9b..b1ae8da 100644 --- a/js/expand-info.js +++ b/js/expand-info.js @@ -27,27 +27,27 @@ document.querySelector('.expandAll').onclick = function (e) { if (all_status == "hide") { obj.setAttribute("collapse-status", "show"); obj.querySelector(".expandAllText").innerHTML = "Collapse All"; - obj.parentNode.querySelectorAll(".tourDatesBJ span[id$='Icon']").forEach(function (icon, i) { + obj.parentNode.querySelectorAll("div[collapse] span[id$='Icon']").forEach(function (icon, i) { icon.classList.remove('OpenIcon'); icon.classList.add('CloseIcon'); }); - obj.parentNode.querySelectorAll(".ItineraryContent").forEach(function (itinerary, i) { + obj.parentNode.querySelectorAll("div[collapse-content]").forEach(function (itinerary, i) { slideDown(itinerary); }); - obj.parentNode.querySelectorAll(".tourDatesBJ").forEach(function (title, i) { + obj.parentNode.querySelectorAll("div[collapse]").forEach(function (title, i) { title.setAttribute("collapse-status", "show"); }); } else { obj.setAttribute("collapse-status", "hide"); obj.querySelector(".expandAllText").innerHTML = "Expand All"; - obj.parentNode.querySelectorAll(".tourDatesBJ span[id$='Icon']").forEach(function (icon, i) { + obj.parentNode.querySelectorAll("div[collapse] span[id$='Icon']").forEach(function (icon, i) { icon.classList.remove('CloseIcon'); icon.classList.add('OpenIcon'); }); - obj.parentNode.querySelectorAll(".ItineraryContent").forEach(function (itinerary, i) { + obj.parentNode.querySelectorAll("div[collapse-content]").forEach(function (itinerary, i) { slideUp(itinerary); }); - obj.parentNode.querySelectorAll(".tourDatesBJ").forEach(function (title, i) { + obj.parentNode.querySelectorAll("div[collapse]").forEach(function (title, i) { title.setAttribute("collapse-status", "hide"); }); }