dialog opens but page scrolls to top
I have several links that have onmouseover function to open dialog on a div.
The problem is that if the page is long, and when I move to the bottom of the page, when I mouse over the tag, the page is scrolled to the top.
How to avoid this problem?
I have the above code:
- <a href='#' onmouseover="openDialog(19,'tooltip'); return false;" onmouseout="closeDialog(19)" id="note_19" style="cursor:pointer">
- <div id="dialog_content_19" title="Product: #0015" style="display: none;">
- <b>Author: </b>m<br>
- <b>Start date: </b>Mon 02/14/2011<br>
- <b>End date: </b>Mon 02/21/2011<br>
- <b>Comment: </b><br>
- This is a test promo for 15s and 25s. </div>
- function openDialog(row_index,type) {
- var type_id = type == 'tooltip' ? 'mo_' : '';
- $("#dialog_content_"+type_id+row_index).dialog({
- width:250,
- height:180,
- position:'center'
- });
- $('.ui-dialog').each(function(){
- var top = (row_index-1) * 24.5 + 233;
- if($(this).attr('aria-labelledby') == 'ui-dialog-title-dialog_content_'+row_index || $(this).attr('aria-labelledby') == 'ui-dialog-title-dialog_content_mo_'+row_index) {
- $(this).css('left', '180px');
- $(this).css('top', top+'px');
- }
- });
- return false;
- }
- function closeDialog(row_index) {
- $('.ui-dialog').each(function(){
- if($(this).attr('aria-labelledby') == 'ui-dialog-title-dialog_content_mo_'+row_index) {
- $(this).remove();
- }
- });
- }
As you see my href has # and also the mouseover event has return false, and also the openDialog has return false; It should not scroll to the top of the page.
I am using:
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript"></script>
- <script src="js/jquery/jquery-ui-1.8.10.custom.min.js" type="text/javascript"></script>
- <link rel="stylesheet" href="js/jquery/jquery-ui-1.8.10.custom.css" type="text/css" media="screen" />
What I am doing wrong?