Vous pouvez joindre un achat URL pour l'objet de données et puis attribuez-lui l'URL du bouton sur le image event:
HTML
<div>
<img src="one.jpg">
<a href="buyone.html">Buy now</a>
</div>
<div>
<img src="two.jpg">
<a href="buytwo.html">Buy now</a>
</div>
CSS (par exemple, le style que vous le souhaitez)
.galleria-button {
z-index:3;
padding:5px 10px;
background:#000;
color:#fff;
position:absolute;
top:20px;
left:20px;
cursor:pointer;
}
JS
$('#galleria').galleria({
dataConfig: function(img) {
// return a new buylink key that points to the
// next anchor’s href attribute
return { buylink: $(img).next().attr('href') };
},
extend: function() {
// the current buy link
var buy;
// create the button and append it
this.addElement('button').appendChild('container','button');
// Add text & click event using jQuery
this.$('button').text('Buy now').click(function() {
window.location = buy;
});
// change the buy link on image
this.bind('image', function(e) {
buy = this.getData(e.index).buylink;
});
}
});
Espérait éviter cela en adaptant un thème existant. Prévu d'utiliser le thème des Douze, mais je voulais adapter le thème classique pour me lancer. Suis actuellement à travers la source Galleria pour essayer de l'ajouter là-bas. Pensez que la méthode appendChild est là où je dois être ... –