Created
September 12, 2012 03:23
-
-
Save LogicWolfe/3704096 to your computer and use it in GitHub Desktop.
Steph's Squarespace Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type='text/javascript' src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script> | |
<script type='text/javascript'> | |
$(document).ready(function() { | |
$("#galleryWrapper").delegate( | |
".sqs-active-slide img, .sqs-active-slide .image-description", | |
"mouseenter", | |
function(event) { | |
var image = $(this); | |
var description = $('.image-description', this.parentNode); | |
if (!description.hasClass('parsed')) { | |
var title = $('.image-description > strong:first-child', this.parentNode); | |
title.remove(); | |
var title_text = title.text().replace(/\s\/\s/g, '<br/>') | |
var text = description.text().replace(/\s\/\s/g, '<br/>'); | |
description.html('<strong>' + title_text + '</strong>' + text); | |
description.addClass('parsed'); | |
} | |
var title = $('.image-description > strong:first-child', this.parentNode); | |
title.css({ | |
display: 'block' | |
}); | |
description.css({ | |
width: 200, | |
padding: 12, | |
backgroundColor: 'rgba(255,255,255,0.5)', | |
position: 'absolute', | |
left: image.css('left'), | |
bottom: '24px', | |
color: 'black' | |
}); | |
description.show(); | |
} | |
); | |
$("#galleryWrapper").delegate( | |
".sqs-active-slide img, .sqs-active-slide .image-description", | |
"mouseleave", | |
function(event) { | |
$('.image-description', this.parentNode).hide(); | |
} | |
); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment