dies ein Starter sein könnte, was Sie suchen:
$(document).ready(function() {
$('#tab-to-animate').hover(function() {
// this anonymous function is invoked when
// the mouseover event of the tab is fired
// you will need to adjust the second px value to
// fit the dimensions of your image
$(this).css('backgroundPosition', 'center 0px');
}, function() {
// this anonymous function is invoked when
// the mouseout event of the tab is fired
// you will need to adjust the second px value to
// fit the dimensions of your image
$(this).css('backgroundPosition', 'center -20px');
});
});
leider dieser Code die Frage falsch verstanden tun sollten, vorausgesetzt, die div als Ganzes bewegen, dass man es zunächst die Position unter Verwendung geschoben haben nach unten: relative CSS-Eigenschaft.
$(document).ready(function() {
$('.recruiterLink').hover(function() {
$(this).css({
'position' : 'relative',
'top' : 0
});
}, function() {
$(this).css({
'position' : 'relative',
'top' : 20
});
});
});
Würde das noch funktionieren, wenn der div.recruiterLink absolut positioniert wäre? – Anthony
Ja! Es wird funktionieren, wenn es relativ oder absolut ist. Aber dann sollten Sie ein Wrapper um Ihr Menü haben, mit relativen Positionen, damit die Schaltfläche nicht absolut auf der Seite positioniert wird, sondern auf ihrem Wrapper. – Flipke