-2

I have seen a tutorial about Modal Dialog Box Effect on Codrops site.

I show that they used "~" symbol which is given below

.md-modal 
{
    position: fixed;
    top: 50%;
    left: 50%;
    width: 50%;
    max-width: 630px;
    min-width: 320px;
    height: auto;
    z-index: 2000;
    visibility: hidden;
    backface-visibility: hidden;
    transform: translateX(-50%) translateY(-50%);
}

.md-show {
    visibility: visible;
}


.md-overlay {
    position: fixed;
    width: 100%;
    height: 100%;
    visibility: hidden;
    top: 0;
    left: 0;
    z-index: 1000;
    opacity: 0;
    background: rgba(143,27,15,0.8);
    transition: all 0.3s;
}

Main Problem: Here they used "~" symbol but for what??

.md-show ~ .md-overlay 
{
    opacity: 1;
    visibility: visible;
}

Can anyone help me through this problem. Also i want to use jQuery instead of JavaScript which is provided within the code. Please Help me...

user2845946
  • 1,755
  • 29
  • 38

2 Answers2

0

The general sibling combinator selector is very similar to the adjacent sibling combinator selector we just looked at. The difference is that that the element being selected doesn't need immediately succeed the first element, but can appear anywhere after it.

Read the following: http://css-tricks.com/child-and-sibling-selectors/

In addition, this post should not have been tagged with JavaScript. This is a pure CSS question.

Joe Johnson
  • 1,814
  • 16
  • 20
0

The ~ or tilde is the general sibling selector. It separates two selectors and matches the second element only if it is preceded by the first, and both share a common parent.

Here is more information on the little squiggly dude...

https://developer.mozilla.org/en-US/docs/Web/CSS/General_sibling_selectors

Dryden Long
  • 10,072
  • 2
  • 35
  • 47