So sieht das Template jetzt aus. Vielleicht hilft es ja jemandem :-)
Vielen Dank für eure Beiträge!
Code:
<script src="<?php echo TL_ASSETS_URL; ?>assets/jquery/ui/<?php echo JQUERY_UI; ?>/jquery-ui.min.js"></script>
<script>
(function($) {
$(document).ready(function() {
$(document).accordion({
// Put custom options here
heightStyle: 'content',
header: 'div.toggler',
collapsible: true
});
var activate = function(tog) {
var tgs = $('div.toggler');
tgs.removeClass('active');
tog.addClass('active');
tgs.next('div.accordion').attr('aria-hidden', 'true');
tog.next('div.accordion').attr('aria-hidden', 'false');
//alert("in");
var togt = tog;
window.setTimeout(function(){
//alert(that);
//window.scrollTo(0, $(togt).offset().top);
$('html').animate({scrollTop : $(togt).offset().top},500);
}, 500);
};
$('div.toggler').focus(function(e) {
$('div.toggler').attr('tabindex', 0);
$(this).attr('tabindex', -1);
}).blur(function() {
$(this).attr('tabindex', 0);
}).click(function() {
activate($(this));
}).keypress(function(event) {
if (event.keyCode == 13) activate($(this));
}).on( "accordionactivate", function(event,ui){
if ($(ui.newHeader).offset() != null) {
ui.newHeader, $("html, body").animate({scrollTop:($(ui.newHeader).offset().top)}, 1500);}
});
});
})(jQuery);
</script>
Lesezeichen