Skip to content

Instantly share code, notes, and snippets.

@eschie
Created March 22, 2012 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eschie/2159048 to your computer and use it in GitHub Desktop.
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
<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