Skip to content

Instantly share code, notes, and snippets.

@ghostbar
Created September 13, 2011 05:15
Show Gist options
  • Save ghostbar/1213171 to your computer and use it in GitHub Desktop.
Save ghostbar/1213171 to your computer and use it in GitHub Desktop.
Script for swapping img's src attr synced with tabs from jQueryUI
/* @author Jose Luis Rivas <[email protected]>
*
* @desc swaping full-background pages with jQuery UI's Tabs plugin events.
*/
$(document).ready(function() {
$( "#slides" ).bind( "tabsshow", function(event, ui) {
var tabattr = $('.ui-state-active').find('a').attr('href');
switch(tabattr) {
case '#tab1':
$('img#bg').attr('src', '/img/tab1.jpg');
break;
case '#tab2':
$('img#bg').attr('src', '/img/tab2.jpg');
break;
default:
$('img#bg').attr('src', '/img/tab1.jpg');
break;
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment