beatovich: Experiment details/summary

Beitrag lesen

hallo

kleine Bugfixes

//<!-- function init(){ document.body.classList.remove("noscript"); document.querySelectorAll(".tablist [aria-expanded], .details [aria-expanded]") .forEach( function(item){ item.setAttribute("aria-expanded",false); }); document.querySelectorAll("details").forEach( function(detail){ detail.querySelector("summary").setAttribute("aria-expanded","false"); detail.addEventListener( "click", function(ev){

			if( ev.target.nodeName !== "SUMMARY") return;
  	ev.stopPropagation();
  	let thisEl=this;
  	console.log(thisEl.querySelector("summary"));
  	thisEl.querySelector("summary").setAttribute("aria-expanded","true");
  	var col = this.parentElement.querySelectorAll("details");
  	col.forEach( function(item){
  		if(item === thisEl){
  			if( item.open == ""){
  				item.removeAttribute("open");
  				item.querySelector("summary").setAttribute("aria-expanded","true");
  			}
  			else{
  				item.querySelector("summary").setAttribute("aria-expanded","false");
  			}
  		}
  		else{
  			item.removeAttribute("open");
  			item.querySelector("summary").setAttribute("aria-expanded","false");
  		}
  	} );
  }

); }); }

// replace init();

document.addEventListener('DOMContentLoaded', init, false);

// --> </script>

</body> </html>



-- 
Neu im Forum!
Signaturen kann man ausblenden!
--
Neu im Forum! Signaturen kann man ausblenden!