jQuery-Tools-overlay 使用介绍
代码如下:
<!doctype html>
<html>
<head>
<title>jquery tools standalone demo</title>
<!-- include the tools -->
<script src="https://cdn.jquerytools.org/1.2.7/full/jquery.tools.min.js"></script>
<!-- standalone page styling (can be removed) -->
<link rel="stylesheet" type="text/css"
href="./overlay-basic.css"/>
<style>
/* some styling for triggers */
#triggers {
text-align:center;
}
#triggers img {
cursor:pointer;
margin:0 5px;
background-color:#fff;
border:1px solid #ccc;
padding:2px;
-moz-border-radius:4px;
-webkit-border-radius:4px;
}
/* styling for elements inside overlay */
.details {
position:absolute;
top:15px;
right:15px;
font-size:11px;
color:#fff;
width:150px;
}
.details h3 {
color:#aba;
font-size:15px;
}
</style>
</head>
<body><!-- trigger elements -->
<p id="triggers">
<img src=https://www.2cto.com/uploadfile/2018/0605/20180605114001685.jpg" rel="#mies1"/>
<img src=https://www.2cto.com/uploadfile/2018/0605/20180605114002839.jpg" rel="#mies2"/>
</p>
<!-- overlays -->
<p class="simple_overlay" id="mies1">
<img src=https://www.2cto.com/uploadfile/2018/0605/20180605114002206.jpg" />
<p class="details">
<h3>the barcelona pavilion</h3>
<h4>barcelona, spain</h4>
<p>
the barcelona pavilion, designed by ludwig mies van der rohe,
was the german pavilion for the 1929 international exposition in
barcelona, spain. it was an important building in the history of
modern architecture.
</p>
<p>
several critics, historians and modernists have declared it "the
most beautiful building of the century"
</p>
</p>
</p>
<p class="simple_overlay" id="mies2">
<img src=https://www.2cto.com/uploadfile/2018/0605/20180605114002522.jpg" />
<p class="details">
<h3>the barcelona pavilion</h3>
<h4>barcelona, spain</h4>
<p>
another unique feature of this building is the <em>exotic
materials mies chose to use</em>.
</p>
<p>
plates of high-grade stone materials like veneers of tinos verde
antico marble and golden onyx as well as tinted glass of grey,
green, white, in addition to translucent glass, perform
exclusively as spatial piders.
</p>
</p>
</p>
<script>
$(document).ready(function() {
$("img[rel]").overlay({
closeonclick:false,
mask: 'darkred'
});
});
</script>
</body>
</html>
css
. 代码如下:
/* the overlayed element */
.simple_overlay {
/* must be initially hidden */
display:none;
/* place overlay on top of other elements */
z-index:10000;
/* styling */
background-color:#333;
width:675px;
min-height:200px;
border:1px solid #666;
/* css3 styling for latest browsers */
-moz-box-shadow:0 0 90px 5px #000;
-webkit-box-shadow: 0 0 90px #000;
}
/* close button positioned on upper right corner */
.simple_overlay .close {
background-image:url(./close.png);
position:absolute;
right:-15px;
top:-15px;
cursor:pointer;
height:35px;
width:35px;
}
关闭的css的命名: xxx .close。
上一篇: 学vuejs看什么书