简体   繁体   中英

dynamically make top div position

So I have created a simple calendar ( http://www.akapa.org/newsite/events/calendar.htm ) and I have a bunch of "More Info" buttons I made from cells. In a table cell to the right are a bunch of hidden DIV's that all appear when you rollover a "More Info" button, obviously giving more details about the calendar date/event.

My problem is that I have to give an exact "top" css position to every one of these hidden div's every single time I add a new event to the calendar. I want to dynamically tell each hidden div to match the "top" css position to match the top position of each "More Info" button. How do I do that?

You should use jQuery ; it makes Javascript much easier.

Using jQuery, you can write the following:

$('#' + popupId).top($('#'+tdId).offset().top);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM