How to find a active sibling among others (or) How to find a active child node of a parent? Only Javascript please -
<div id=main> <img id=leftbutton> <div id=inner> <div class=one> <img /> <img /> </div> <div class=two> <img /> <img /> </div> <div class=two> <img /> <img /> </div> <div> <img id=rightbutton> </div> </div> </div> trying create carousel.i hiding class(two) @ first showing class(one). if knew active class(which displayed) can make function display next sibling when press rightbutton how identify siblings displayed among other siblings
if question right, might clever add 'active' class active class (haha ;) ). can class flagged class. in pure js have add , remove further class string operations on class-property of element. therefore see this
depending on css use hiding elements in first place properties. assuming use display:none; , display:block; 1 set block;
//edit: provided needed answer needs. visible element in fiddle getting alerted.
var lookup = document.getelementbyid('lookup'); for(i in lookup.children){ var elementdisplay = window.getcomputedstyle(lookup.children[i]).display; if(elementdisplay != 'none' ){ //whatever want visible element goes h alert(lookup.children[i].innertext); } }
Comments
Post a Comment