это может быть стартером, что вы ищете:
$(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');
});
});
извините неправильно вопрос этого код должен делать переместить DIV в целом при условии, что вы его толкнули вниз первоначально используя положение: относительный css свойство.
$(document).ready(function() {
$('.recruiterLink').hover(function() {
$(this).css({
'position' : 'relative',
'top' : 0
});
}, function() {
$(this).css({
'position' : 'relative',
'top' : 20
});
});
});
Будет ли это работать, если div.recruiterLink был абсолютно позиционирован? – Anthony
Да! Он будет работать, если он относительный или абсолютный. Но тогда у вас должна быть обертка вокруг вашего меню с относительным положением, поэтому кнопка не будет позиционироваться абсолютно на странице, а на ее обертке. – Flipke