I’ve added some script to my site: http://cargocollective.com/btatest
However, I’d love to move it down 40px.
I’ve tried to wrap it in a div, but to no avail.
Here’s the script:
<script type="text/javascript">
// The social div
var $socialDiv,
// The social div's height
socialDivHeight = 500,
currentSocialDivHeight = socialDivHeight;
$(document).ready(function() {
$socialDiv = $('.social');
$socialDiv.css({
'background-image': 'url(http://fearthegrizzly.com/productions/theacrobat/web3.jpg)',
'background-repeat': 'no-repeat',
'background-attachment': 'fixed',
'background-size' : '110% 100%',
'height' : socialDivHeight + 'px',
'margin-left' : '-50%',
'margin-right' : '-50%',
});
});
$(window).scroll(function() {
//Get scroll position of window
var windowScroll = $(this).scrollTop();
var newSocialDivHeight = Math.max(0, socialDivHeight - windowScroll);
if (Math.abs(newSocialDivHeight - currentSocialDivHeight) < 1)
return;
$socialDiv.css({
'opacity' : 1 - windowScroll / 400
});
currentSocialDivHeight = newSocialDivHeight;
});
</script>
Any help would be appreciated.
Thanks
Michael
Add
margin-topproperty to your Class Name .social CSS settings like this: