[TYPO3-english] drop down menu
Martin Mädler
martin.maedler at rwth-aachen.de
Mon Aug 22 09:32:16 CEST 2011
quick follow-up: the JavaScript code in my last post doesn't work
properly (tried to simplify it and broke it ;)
you also need the hoverIntent jQuery plugin and then this code (but
you're probably better off with the tutorial Urs Bräm linked to):
$dropdownSet = $('.dropdown');
$dropdownSet.prev().hoverIntent(
function() {
$(this).addClass('hover');
$(this).next().slideDown();
},
function() {}
);
$dropdownSet.prev().hover(
function() {
$(this).next().data('dropdown', true);
},
function() {
$this = $(this).next();
$this.data('dropdown', false);
setTimeout(function() {
if($this.data('hover') !== true) {
$this.fadeOut('fast');
$this.prev().removeClass('hover');
}
}, 10);
}
);
$dropdownSet.hover(
function() {
$(this).data('hover', true);
},
function() {
$this = $(this);
$this.data('hover', false);
setTimeout(function() {
if($this.data('dropdown') !== true) {
$this.fadeOut('fast');
$this.prev().removeClass('hover');
}
}, 10);
}
);
More information about the TYPO3-english
mailing list