-
Slider in Colorbox
Hallo,
stehe grad etwas vor ein Problem bzw. Lösungfindung
Wie kann ich denn den Contao Slider in einer Colorbox nutzen?
Also ich öffner mir ein Colorbox per Klick wie üblich in der Inhalt erscheint, das klappt auch. Ich würde aber gern darin auch einen Slider für Bilder nutzen
Eingebunden ist der Slider ganz normal über den Contao-Standard
Folgenden Code habe ich jetzt nochmal in die Colorbox eingefügt, jetzt macht er was nur setzt er die width immer auf 0 der Elemente
Code:
onLoad: function() {
$.ajax({
...
success: function(data) {
var e = document.querySelectorAll('.content-slider, .slider-control'), c, i;
for (i=0; i<e.length; i+=2) {
c = e[i].getAttribute('data-config').split(',');
new Swipe(e[i], {
// Put custom options here
'auto': parseInt(c[0]),
'speed': parseInt(c[1]),
'startSlide': parseInt(c[2]),
'continuous': parseInt(c[3]),
'menu': e[i+1]
});
}
-
So funktioniert alles bis auf das es bei der ersten lightbox (colorbox) öfnet es zweimal das slider-menu einbinden, geht man eins weiter un wieder zurück ist es nur einmal da:(
Code:
<script type="text/javascript">
jQuery(document).ready(function(){
$(document).bind('cbox_complete', function(){
var e = document.querySelectorAll('.content-slider, .slider-control'), c, i;
for (i=0; i<e.length; i+=2) {
c = e[i].getAttribute('data-config').split(',');
new Swipe(e[i], {
// Put custom options here
'auto': parseInt(c[0]),
'speed': parseInt(c[1]),
'startSlide': parseInt(c[2]),
'continuous': parseInt(c[3]),
'menu': e[i+1]
});
}
});
$(".layout_merch a").colorbox({
rel: $(this).attr("data-lightbox"),
inline: true,
fixed: true,
width: '100%',
height: '100%',
maxWidth: '100%',
maxHeight: '100%',
dataType: "html",
onLoad: function() {
$.ajax({.......
var e = document.querySelectorAll('.content-slider, .slider-control'), c, i;
for (i=0; i<e.length; i+=2) {
c = e[i].getAttribute('data-config').split(',');
new Swipe(e[i], {
// Put custom options here
'auto': parseInt(c[0]),
'speed': parseInt(c[1]),
'startSlide': parseInt(c[2]),
'continuous': parseInt(c[3]),
'menu': e[i+1]
});
}
}
});
}
});
});
</script>