Skip to content

Instantly share code, notes, and snippets.

@nastysloper
Created June 9, 2013 20:56
Show Gist options
  • Save nastysloper/5745176 to your computer and use it in GitHub Desktop.
Save nastysloper/5745176 to your computer and use it in GitHub Desktop.
http://jsfiddle.net/nastysloper/qYwV7/ Toggle photo information
$(document).ready(function() {
$('#tour').on('click', 'button', function() {
$('.photos').slideToggle();
});
function showPhotos() {
$(this).find('span').slideToggle();
}
$('.photos').on('mouseenter', 'li', showPhotos).on('mouseleave', 'li', showPhotos);
});
span {
display: none;
}
<div id='tour'>
<h2>Paris, France Tour</h2>
<p>$2,499 for 7 Nights</p>
<button>See photos from our last tour</button>
<ul class='photos'>
<li>
<img src="/assets/photos/paris1.jpg" />
<span>Arc de Triomphe</span>
</li>
<li>
<img src="/assets/photos/paris2.jpg" />
<span>The Eiffel Tower</span>
</li>
<li>
<img src="/assets/photos/paris3.jpg" />
<span>Notre Dame de Paris</span>
</li>
</ul>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment