Click "Register" on the page, there is a layer of opaque black mask, the top of the mask layer is the registration box, at this time can not click on the page other than the registration box elements, click on the Registration box "casually stroll", mask layer disappear.
Preview Address:
http://jsfiddle.net/p2x3c7df/embedded/result/
Points:
1. The registration box is always horizontally and vertically centered, including the mouse wheel scrolling down the page, scaling the page and adjusting the browser window for a large hour
Mainly by CSS control, the width and height of the Register box has been determined (620*420px), first use position:fixed to make it absolute position relative to the browser window, and then align it vertically: top:50%; left:50%; margin:-210px 0 0-310px;
2. When zooming the page and resizing the browser window, the mask layer needs to always cover the entire document and the entire browser's visual window, as well as the parts that need scrolling to navigate, and need to be compatible with different kernel browsers such as chrome and IE.
Two important attributes: JS Window.screen.availHeight and jquery $ (document.body). Outerheight (True). Window.screen.availHeight refers to the height of the available work area of the screen, $ (document.body). Outerheight (true) refers to the total width of the body of the browser's current window document, including border padding margin. Window.screen.availHeight is mainly used for IE (11) Scaling pages, the mask layer can still fill the browser window.
3. When the mask layer appears, the page can still scroll up and down, but cannot manipulate other elements except the landing box in the page
Code:
HTML (need to test high enough documents):
Copy Code code as follows:
<div id= "Wrap" >
<div id= "Rbox" ><a class= "Go" href= "#" onclick= "return false;" > go for a stroll >></a></div>
<div id= "Mask" ></div>
<div class= "Content" >
<div id= "Usertie" >
<span>
<a id= "Register" href= "#" onclick= "return false;" > Registration </a>
</span>
</div>
The suicide.
Meanwhile Monte Cristo had also returned to town with Emmanuel and Maximilian. Their return is cheerful. Emmanuel did not conceal he joy at the peaceful termination of the affair, and is loud in his expressions of delight. Morrel, in a corner of the carriage, allowed his brother-in-law's gayety to expend itself in words, while him felt equal in Ward Joy, which, however, betrayed itself only in his countenance. At the Barriere du Trone they met Bertuccio, who is waiting there, motionless as a sentinel at his post. Monte Cristo put him head out of the window, exchanged a few words with him in a low tone, and the steward disappeared. ' Count, ' said Emmanuel, when they were at the ' place ' Royale, ' Put me down ' in my door, which I wife may not have A single moment of needless anxiety in my account or yours.
"If it were not ridiculous to make a display of we triumph, I would invite the count to my house;" Besides that, he doubtless has some trembling heart to comfort. So we'll take leave of our friend, and let him hasten home. "
"Stop a moment," said Monte Cristo; "Don't let me lose both my companions. Return, Emmanuel, to your charming wife, and present me best compliments to her; Morrel, accompany me to the Champs Elysees.
"willingly," said Maximilian; "Particularly as I have business in that quarter."
"Shall We wait Breakfast for you" asked Emmanuel.
"No," replied the young man. The door was closed, and the carriage proceeded. "What good fortune I brought you!" said Morrel, when he is alone with the count. "Have you don't thought so?"
"Yes," said Monte Cristo; "For this reason I wished to keep you near me."
' It is miraculous! ' continued Morrel, answering his own thoughts.
"What?" said Monte Cristo.
"What has just happened."
"Yes," said the Count, "You are right--it's miraculous."
"For the Albert is brave," resumed morrel.
"Very Brave," said Monte Cristo; "I have seen him sleep with a sword suspended over his head."
"She's going to leave her house," said the steward.
"And her son?"
"Florentin, his valet and thinks he are going to do the same."
"Come this way." Monte Cristo took Bertuccio into he study, wrote the letter we have seen, and gave it to the steward. "Go," said he quickly. "But, let Haidee is informed that I have returned."
"Here I am," said the young girl, who at the sound's carriage had run down-stairs and whose face is radiant with joy At seeing the count return safely. Bertuccio left. Every transport of a daughter finding a father, all the delight of a mistress seeing a adored lover, were felt by Haidee During the moments of this meeting, which she had eagerly expected. Doubtless, although less evident, Monte Cristo ' s joy is not less intense. Joy to Hearts which have suffered long was like the dew on the ground after a long drought; Both the heart and the ground absorb that beneficent moisture falling on them, and it is outwardly apparent.
Monte Cristo is beginning to do, what he had does a long time dared to believe, that there were two Mercedes in the World, and him might yet be happy. His eye, elate and happiness, was reading eagerly the tearful gaze of Haidee, when suddenly the door opened. The count knit his brow. "M. de morcerf!" said Baptistin, as if that name sufficed to his excuse. In fact, the count ' s face brightened.
"Which," asked he, "the viscount or the count?"
"The count."
"Oh," exclaimed Haidee, "Is it isn't yet over?"
"I know not if it's finished, my beloved child," said Monte Cristo, taking the young girl ' s hands; "But I do know you have no more to fear."
"But It is the wretched"--
"That mans cannot injure me, Haidee," said Monte Cristo; "It was he son alone that there is cause to fear."
"And what I have suffered," said the young girl, "for you shall never know, our Lord." Monte Cristo smiled. "By my father's tomb," said he, extending's his hand over the head of the young girl, "I swear to you, Haidee, so if any m Isfortune happens, it won't be yes to me.
the door was wide open, a hackney-coach is standing in the middle of the yard --a strange sight before so noble a mansion; The count looked at it and terror, but without daring to inquire its meaning, and he rushed towards his apartment. Two persons were coming down the stairs; He had a alcove to avoid them. It is Mercedes leaning on her son's arm and leaving the house. They passed close by the unhappy being, who, concealed behind the damask curtain, almost felt Mercedes dress, brush past hi M, and his son's warm breath, pronouncing these words,--"courage, mother! Come, this are no longer our home! " The words died away, the steps were lost in the distance. The general drew himself up and clinging to the curtain; He uttered the most dreadful sob which ever escaped to the bosom of a father abandoned at the same Son. He soon heard the clatter's iron step of the Hackney-coach, then the coachman ' s VOice, and then the rolling of the heavy vehicle shook the windows. He darted to his bedroom to the "once more all" had loved in the world; But the Hackney-coach drove on and the head of neither Mercedes nor her son appeared at the windows to take a The house or the deserted father and husband. And at the very moment when the wheels of coach crossed the gateway A is heard, and a thick smoke escaped thr Ough one of the panes of the window, which was broken by the explosion.
the door was wide open, a hackney-coach is standing in the middle of the yard --a strange sight before so noble a mansion; The count looked at it and terror, but without daring to inquire its meaning, and he rushed towards his apartment. Two persons were coming down the stairs; He had a alcove to avoid them. It is Mercedes leaning on her son's arm and leaving the house. They passed close by the unhappy being, who, concealed behind the damask curtain, almost felt Mercedes dress, brush past hi M, and his son's warm breath, pronouncing these words,--"courage, mother! Come, this are no longer our home! " The words died away, the steps were lost in the distance. The general drew himself up and clinging to the curtain; He uttered the most dreadful sob which ever escaped to the bosom of a father abandoned at the same Son. He soon heard the clatter's iron step of the Hackney-coach, then the coachman ' s VOice, and then the rolling of the heavy vehicle shook the windows. He darted to his bedroom to the "once more all" had loved in the world; But the Hackney-coach drove on and the head of neither Mercedes nor her son appeared at the windows to take a The house or the deserted father and husband. And at the very moment when the wheels of coach crossed the gateway A is heard, and a thick smoke escaped thr Ough one of the panes of the window, which was broken by the explosion.
</div>
</div>
Html
Css:
Copy Code code as follows:
a{text-decoration:none; color: #fff;}
#rbox {
width:620px;
height:420px;
position:fixed;
top:50%;
left:50%;
margin:-210px 0 0-310px;
border-radius:8px; /* Rounded Corner * *
Background-color: #999;
Z-index:3;
Display:none;
}
. go{
Position:absolute;
right:10px;
top:10px;
padding:5px 12px;
Background:rgba (0,0,0,.4);
box-shadow:0 0 0 2px Rgba (255,255,255,.4);
Color: #fff;
border-radius:26px;
}
#mask {
Background-color: #000;
Position:absolute;
top:0;
left:0;
Display:none;
Z-index:2;
}
#register {z-index:1; color:blue;}
. content{width:800px; height:auto; margin:0 auto;
Js:
Copy Code code as follows:
$ (function () {
Click to register
$ ("#register"). Click (function () {
if (Window.screen.availHeight > $ (document.body). Outerheight (True)) {
When the height of the available work area on the screen > browser Current Window document body's total height includes border padding margin (zoom)
$ ("#mask"). Show (). CSS ({"opacity": "0.5", "width": "100%", "Height": window.screen.availHeight});
}else{
$ ("#mask"). Show (). CSS ({"opacity": "0.5", "width": "100%", "Height": $ (document.body). Outerheight (True)});
}
$ ("#rbox"). Show ();
});
Adjusts the width and height of the mask according to the changes in the browser's visual window, making the mask full of browsers
$ (window). Resize (function () {
Changes the mask width and height according to browser window changes, making the mask fill the entire browser
if ($ ("#mask"). CSS ("width")!=0) {
$ ("#mask"). CSS ("width", "100%"); If necessary, the width can also be judged
if (Window.screen.availHeight > $ ( document.body). Outerheight (True) {
$ ("#mask"). CSS ({" Opacity ":" 0.5 "," width ":" 100% "," Height ": window.screen.availHeight});
}else{
$ ("#mask"). CSS ({"opacity": "0.5", "width": "100%", "Height": $ (document.body). Outerheight ( true)};
}
}
});
$ (". Go"). Click (function () {
$ ("#mask"). Hide ();
$ ("#rbox"). Hide ();
});
});
This completes the function.