Skip to main content

Forums

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #299749
    DragonTheory
    Participant

    Hey there. Can media queries be used to detect a CSS selector to affect change?

    Example:
    When the .loaded class is dynamically loaded somewhere in the parent “.profile”, the adjacent parent “.results” changes width from 0 to 25%.

    Maybe something like…

    /* Closed State (default) */
    .results {width: 0;}
    /* Open State */
    @media (width = 100% ) { /* Whatever rule that allows the this media query to be true all the time */
         .details .loaded { /* If .loaded class appears in the parent .details */
              .results {
                   width: 25%; /* Change adjacent parent .results to width 25%. */
              }
         }
    }
    

    HTML:

    <div class="results">
         <div class="list-of-results"></div>
    </div>
    <div class="details">
         <div class="dynamically-loaded-content loaded"></div>
    </div>
    
    #299784
    Dainis
    Participant

    +1 for this query – following. thanks

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.