<body>
<div id="content">
<button id="btn-click">Click</button>
<button id="btn-hover">Hover</button>
<h1>The Complete jQuery Course - Project Structure</h1>
<div class="gallery">
<img src="https://source.unsplash.com/random/500x300">
<img src="https://source.unsplash.com/random/500x299">
<img src="https://source.unsplash.com/random/500x298">
</div>
<div class="red-box">Red</div>
<div class="green-box">Green</div>
<div class="blue-box">Blue</div>
<div class="dummy">Dummy</div>
<div class="clear"></div>
<h2>I'm a Headline 2</h2>
<p data-mydata="Some data here">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Harum magnam, provident soluta <em>beatae</em> dolore quis, omnis cumque alias maiores itaque ea neque sapiente quaerat accusamus et illum pariatur consequuntur cum!</p>
<p>Lorem ipsum dolor sit amet,
<a href="/url">URL Project structure</a> consectetur adipisicing elit. Ut quibusdam ducimus a dolore atque maiores tempore minus pariatur, obcaecati fugit?</p>
<!-- An unordered list with ID "list" -->
<ul id="list">
<li>Main item 1
<ul>
<li>Sub item 1</li>
<li>Sub item 2</li>
</ul>
</li>
<li>Main item 2
<ul>
<li>Sub item 1</li>
<li>Sub item 2</li>
</ul></li>
<li>Main item 3
<ul>
<li>Sub item 1</li>
<li>Sub item 2</li>
</ul></li>
<li>Main item 4
<ul>
<li>Sub item 1</li>
<li>Sub item 2</li>
</ul></li>
</ul>
<!-- A form element without class or ID -->
<form action="">
<input type="text"><br>
<input type="email"><br>
<input type="range" min='1' max='10' value='7'>
<input type="checkbox" name="cb" checked>
<label for="cb">Check me</label><br>
<textarea name="message" id="message" cols="30" rows="10"></textarea><br>
<input type="radio" name="toc" value="read" id="read">
<label for="read">Read it all</label> <br>
<input type="radio" name="toc" value="tldr" checked> <label for="tldr">TL;DR</label> <br>
<input type="submit" value="Submit">
</form>
</div>
<div class="lightbox"></div>
</body>
.lightbox {
position: absolute;
top: 0;
left: 0;
display: none;
width: 30%;
height: 60%;
padding: 15% 35% 25% 35%;
color: #000000;
background-color: rgba(200, 100, 0, 0.9);
text-align: center;
text-shadow: #333 0 1px 0; }
.red-box {
float: left;
width: 80px;
height: 80px;
margin: 10px 10px 10px 0;
padding: 10px;
color: #ffffff;
background-color: #880000; }
.green-box {
float: left;
width: 80px;
height: 80px;
margin: 10px 10px 10px 0;
padding: 10px;
color: #ffffff;
background-color: #008800; }
.blue-box {
float: left;
width: 80px;
height: 80px;
margin: 10px 10px 10px 0;
padding: 10px;
color: #ffffff;
background-color: #000088; }
.large {
font-size: 125%;
}
.emphasize {
color: #666;
font-style: italic;
}
/* .gallery {
height: 400px;
width: 600px;
position: relative;
overflow: hidden;
} */
.gallery img {
/* position: absolute; */
/* height: 400px;
width: 600px;
left: 600px; */
}
/* .gallery img:nth-child(1) {
left: 0;
} */
fieldset {
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px; }
label {
display: inline-block;
min-width: 100px; }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"] {
margin: 8px;
padding: 6px 12px;
outline: none;
border: 1px solid #666;
border-radius: 4px;
box-shadow: inset 0 0 3px 3px #fafafa; }
input[type="submit"] {
font-family: "Trebuchet MS", Verdana, Arial, sans-serif;
font-size: 16px;
padding: 4px 8px;
background-color: #fcfcfc;
box-shadow: 0 0 1px 0 #aaa;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px; }
input[type="submit"]:hover {
background-color: #f4f4f4;
box-shadow: 0 0 1px 0 #ccc; }
html {
min-height: 100%;
background-color: #0769ad;
box-shadow: 0 0 8px 4px #06599d inset; }
body {
font-size: 16px;
font-family: "Trebuchet MS", Verdana, Arial, sans-serif; }
.clear {
clear: both; }
#content {
overflow: auto;
width: 80%;
background-color: #fff;
margin: 30px auto 0 auto;
padding: 20px 30px;
border-radius: 8px;
-moz-border-radius: 8px;
-webkit-border-radius: 8px; }
h1 {
color: #000; }
h2 {
border-bottom: 1px solid #aaa; }
#dashboard {
position: absolute;
width: 120px;
height: 60%;
left: -140px;
top: 100px;
padding: 20px;
border-radius: 0 6px 6px 0;
box-shadow: 0 0 3px 3px #f0f0f0;
background-color: #999; }
.fancy-link {
display: inline-block;
text-decoration: none;
color: #111199; }
.fancy-link:after {
display: block;
content: '';
border-bottom: solid 1px #22a;
transform: scaleX(0.0001);
transition: transform 250ms ease-in-out; }
.fancy-link:hover:after {
transform: scaleX(1); }
$(() => {
var galleryItems = $(".gallery").find("img");
galleryItems.css("width", "33%").css("opacity", "0.7");
galleryItems.mouseenter(function() {
$(this).stop().fadeTo(500, 1.0);
});
galleryItems.mouseleave(function() {
$(this).stop().fadeTo(500, 0.7);
});
galleryItems.click(function() {
var source = $(this).attr("src");
console.log(source); //https://source.unsplash.com/random/.... を取得
var image = $("<img>").attr("src", source).css("width", "100%");
$(".lightbox").empty().append(image).fadeIn(1000);
});
$(".lightbox").click(function() {
$(this).stop().fadeOut();
});
});
This Pen doesn't use any external CSS resources.