I have this code: http://jsfiddle.net/cmac2712/dnLgD/
$(document).ready(function () {
var setVisibility = function(n){
$('#content1').css('visibility', 'hidden');
$('#content2').css('visibility', 'hidden');
$('#content3').css('visibility', 'hidden');
$('#content4').css('visibility', 'hidden');
$('#content' + n).css('visibility', 'visible');
};
$('#op1').click( function () {
setVisibility("1");
$('.pointer').animate({
top: '16px'
});
})
$('#op2').click( function () {
setVisibility("2");
$('.pointer').animate({
top: '38px'
});
})
$('#op3').click( function () {
setVisibility("3");
$('.pointer').animate({
top: '60px'
});
})
$('#op4').click( function () {
setVisibility("4");
$('.pointer').animate({
top: '82px'
});
})
})
On line 20 I want to pass in a value that references the 'top' attribute of the option list item so that the pointer div animates to the same position as the list item that is clicked, however I'm not sure how to reference that attribute.
Any ideas?