Skip to content

Instantly share code, notes, and snippets.

@mjau-mjau
Last active August 29, 2015 14:10
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 mjau-mjau/eb7190f1d445fa5e71a0 to your computer and use it in GitHub Desktop.
Save mjau-mjau/eb7190f1d445fa5e71a0 to your computer and use it in GitHub Desktop.
X3 Banner Rotate
.page-banner {
text-align: center;
}
.page-banner img {
opacity: 1;
width: auto;
}
var x3_load_page;
(function() {
// Banners src folder
var path = '/x3/content/banners/';
// Define your banners per path match
var banners = [
{
path : 'concepts/justified/default/',
src : 'banner1.jpg',
href : 'http://imagevuex.com'
},
{
path : 'concepts/justified/',
src : 'banner2.jpg',
href : 'http://disney.com'
},
{
path : 'concepts/',
src : 'banner3.jpg',
href : 'http://mjau-mjau.com'
}
];
// Banner template
var template =
'<div class=page-banner>
<a href=$HREF>
<img src=$SRC alt="" />
</a>
</div>';
// Add Banner function
function addBanner(){
$.each(banners, function(index, val) {
if($.url().attr('path').indexOf(val.path) >= 0){
$('.context > .content').prepend(template.replace('$HREF', val.href).replace('$SRC', path+val.src));
return false;
}
});
}
// Run on x3_load_page
x3_load_page = addBanner;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment