Created
March 22, 2012 15:31
-
-
Save eschie/2159048 to your computer and use it in GitHub Desktop.
Script of my homepage including featured post video slider (AnythingSlider) and bottom cartridge image hover
This file contains hidden or 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> | |
$(function(){ | |
$('#slider1').anythingSlider({ | |
resizeContents : true, | |
addWmodeToObject : 'transparent', | |
enableNavigation : false, | |
buildArrows : false, | |
easing : 'easeInOutCubic' | |
}) | |
$('#slider2').anythingSlider({ | |
resizeContents : true, | |
addWmodeToObject : 'transparent', | |
navigationFormatter : 'formatText', | |
vertical: true, | |
buildNavigation : true, | |
buildArrows : false, | |
easing : 'swing', | |
delayBeforeAnimate : 500, | |
animationTime : 0, | |
onSlideBegin: function (e, slider) { | |
slider.$items.fadeOut(500); | |
}, | |
onSlideComplete: function (slider) { | |
slider.$items.fadeIn(500, "swing"); | |
}, | |
enableNavigation : false, | |
appendControlsTo : $('#nav1') | |
}) | |
$('<div id="bck"</div>').insertBefore($('#videoslider .thumbNav')) // inserts the back control arrow div into the slider's controlnav | |
$('<div id="fwd"</div>').insertAfter($('#videoslider .thumbNav')) // inserts the forward control arrow div into the slider's controlnav | |
$('#fwd, #bck').click(function(){ // clicking either arrow div controls both sliders | |
var direction = (this.id === 'fwd') ? 'goForward' : 'goBack'; | |
$('ul[id^=slider]').each(function(){ | |
$(this).data('AnythingSlider')[direction](); | |
}) | |
}) | |
$(window).load(function(){ | |
$('div.caption-info').each(function(){ //for each description div... | |
$(this).css('opacity', 0); //...set the opacity to 0... | |
$(this).css('display', 'block'); //...set the display to block | |
$(this).css('width', $(this).siblings('.attachment-post-thumbnail wp-post-image').width()); // NOT WORKING!!! | |
$(this).css('z-index', '3'); | |
}); | |
$('.cartvids li').hover(function(){ // when mouse hover over the wrapper div get it's children elements | |
$(this).children('.caption-info').stop().fadeTo(500, 1); // with class description and show it using fadeTo | |
},function(){ // when mouse out of the wrapper div use fadeTo to hide the div | |
$(this).children('.caption-info').stop().fadeTo(500, 0); | |
}); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment