Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
raykennedy2
11,391 Pointslightbox wont work
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tk | Photography</title>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<header>
<div id="logo">
<a href="index.html"><h1>TK</h1></a>
</div>
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="gallery.html">Gallery</a></li>
<li><a href="about.html">About</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</nav>
</header>
<div id="wrapper">
<section>
<ul id="gallery">
<li>
<a href="img/PIC54.jpg">
<img src="img/PIC54.jpg" alt="">
</a>
</li>
<li>
<a href="img/PIC51.jpg">
<img src="img/PIC51.jpg" alt="">
</a>
</li>
<li>
<a href="img/PIC53.jpg">
<img src="img/PIC53.jpg" alt="">
</a>
</li>
<li>
<a href="img/PIC56.jpg">
<img src="img/PIC56.jpg" alt="">
</a>
</li>
<li>
<a href="img/PIC55.jpg">
<img src="img/PIC55.jpg" alt="">
</a>
</li>
<li>
<a href="img/PIC58.jpg">
<img src="img/PIC58.jpg" alt="">
</a>
</li>
<li>
<a href="img/PIC47.jpg">
<img src="img/PIC47.jpg" alt="">
</a>
</li>
<li>
<a href="img/PIC28.jpg">
<img src="img/PIC28.jpg" alt="">
</a>
</li>
<li>
<a href="img/PIC48.jpg">
<img src="img/PIC48.jpg" alt="">
</a>
</li>
<li>
<a href="img/PIC11.jpg">
<img src="img/PIC11.jpg" alt="">
</a>
</li>
<li>
<a href="img/PIC19.jpg">
<img src="img/PIC19.jpg" alt="">
</a>
</li>
<li>
<a href="img/PIC23.jpg">
<img src="img/PIC23.jpg" alt="">
</a>
</li>
<li>
<a href="img/PIC50.jpg">
<img src="img/PIC50.jpg" alt="">
</a>
</li>
<li>
<a href="img/PIC49.jpg">
<img src="img/PIC49.jpg" alt="">
</a>
</li>
<li>
<a href="img/PIC6.jpg">
<img src="img/PIC6.jpg" alt="">
</a>
</li>
</ul>
<script src="https://code.jquery.com/jquery-3.1.1.js"
integrity="sha256- 16cdPddA6VdVInumRGo6IbivbERE8p7CQR3HzTBuELA="
crossorigin="anonymous"></script>
<script type="text/javacript" src="js/app.js"></script>
<div id="overlay"></div>
</section>
</div>
<footer>
<p>© 2016.</p>
</footer>
</body>
</html>
/*
lightbox
*/
var $overlay = $('<div id="overlay"></div>');
var $image = $('<img>');
//an aimage to overlay
$overlay.append($image);
//add overlay
$('body').append($overlay);
//Capture click event on a link to an image
$('#gallery a').click(function(event) {
event.preventDefault();
var imageLocation = $(this).attr('href');
//Update overlay with th eimage linked in the link
$image.attr("src", imageLocation);
//Show the overlay
$overlay.show();
});
//When overlay is clicked
$overlay.click(function() {
//Hide the overlay
$overlay.hide();
});`
This wont work, i have no idea why?
1 Answer
Seth Kroger
56,416 PointsTake a look where you include jquery. There shouldn't be any spaces in the integrity checksum.