Passing asp control name to Jquery function with an event
Hi All,
I have the following requirement:
In my page, there are 5 icons, when mouse is moved over an icon, a div panel - which is otherwise hidden should be displayed right underneath the icon. So I need to change the position of the div on the mouseover of the image icon - which is asp imagebutton. I have the following code:
var
showMenu =
function
(ev) {
//get the position of the placeholder element
var
pos = $(
"#<%=btnTMS.ClientID %>"
).offset();
var
width = $(
"#<%=btnTMS.ClientID %>"
).width();
var
height = $(
"#<%=btnTMS.ClientID %>"
).height();
//show the menu directly over the placeholder
$(
"#recentActionsDiv"
).css({
"left"
: (pos.left) +
"px"
,
"top"
: height +
"px"
});
$(
"#recentActionsDiv"
).show();
}
var
hideMenu =
function
(ev) {
//get the position of the placeholder element
$(
"#recentActionsDiv"
).hide();
}
$(document).ready(
function
() { $(
"#<%=btnTMS.ClientID %>"
).mouseover(showMenu); $(
"#<%=btnTMS.ClientID %>"
).mouseout(hideMenu); $(
"#<%=btnOLS.ClientID %>"
).mouseover(showMenu); $(
"#<%=btnLTS.ClientID %>"
).mouseover(showMenu); $(
"#<%=btnLTS.ClientID %>"
).mouseout(hideMenu); $(
"#<%=btnPTS.ClientID %>"
).mouseover(showMenu); $(
"#<%=btnCMS.ClientID %>"
).mouseover(showMenu);
});
But here I have hard coded the name of the imagebutton in the showmenu function. How can I pass this as a parameter and get the position of each button to position the div underneath it?
Thanks for any reply
Regards,
Chathu