Skip to content

Instantly share code, notes, and snippets.

@tleen
Created May 16, 2015 02:25
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 tleen/ea661ecdfa904f26324b to your computer and use it in GitHub Desktop.
Save tleen/ea661ecdfa904f26324b to your computer and use it in GitHub Desktop.
var images_to_captions = {
"pic1.jpg" : "This is pic one",
"pic2.jpg" : "second pic is here",
"pic3.jpg" : "blargh",
}
$.BgSwitcher.defineEffect("fadeAndSwitchText", function($el) {
$el.animate({opacity: 0}, this.config.duration, this.config.easing, function(){
// new slide so switch text here
var currentimage = '?';// get this from the css or the context or something
var caption = images_to_captions[currentimage];
$('#caption-box-id').text(caption);
});
});
$(".box").bgswitcher({
images: ["pic1.jpg", "pic2.jpg", "pic3.jpg"],
effect: "fadeAndSwitchText"
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment