Having a strange issue with trying to save the scroll position of a Panel that has an imagemap inside of it. We have implemented a scroll position save along with hidden fields that works great in debug mode but does not work when deployed to the server. The scrollleft always resets to 0. I have even captured the fact in edge debug mode that while the hidden field value might be 1768 the scrollleft still maintains its value of 0 AFTER the execution of the below???
Example:
function restore_scroll(control_id) {
panel = document.getElementById(control_id);
savex = document.getElementById("savex");
savey = document.getElementById("savey");
if (panel != null && panel.hidden == false && savex != null && savey != null) {
panel.scrollLeft = Number(savex.value);
panel.scrollTop = Number(savey.value);
}
}
In debug, savex.value = "1768" and after line execution panel.scrollLeft would still equal 0??? NOTE: I tried converting from string to num but noted this makes no difference, just have not changed back.
And again the confusing part is that it all works fine when debugging???
Page code:
<asp:Panel ID="mappanel" runat="server" ScrollBars="Auto"
Width="1200px" Height="650px" ClientIDMode="Static"
onscroll="save_scroll('mappanel');">
<table>
<tr>
<td id="facilitymaptd" clientidmode="Static" runat="server"
onclick="point_it(event);">
<asp:ImageMap ID="facilitymap" ClientIDMode="Static"
runat="server" ImageAlign="Left"
onclick="ImageMap1_Click" HotSpotMode="PostBack">
</asp:ImageMap>
</td>
</tr>
<!--
<tr>
<td>
<canvas id="mapcan" runat="server">
</canvas>
</td>
</tr>
-->
</table>
</asp:Panel>
I have done some more testing and have found that this looks like a timing issue. I am reloading the imagemap based on a search and if I keep executing this search then sometimes it does retain the scroll position and sometimes it does not???
I say this is timing because when running in debug on my dev machine the loading of the image map is technically local on the dev machine where this does not happen as much. Happens consistently on the deployed server which postbacks are probably a little longer. Does this sound possible?
Thanks in advance
Marshall