点击链接时滚动到页面底部
Scrolling to bottom of the page when link clicked?
当链接被点击时,我打开jQuery对话框。对话框打开良好,但页面向下滚动到页面,所以我不能看到对话框,直到我向上滚动。我怎样才能避免这种情况呢?
<script language="javascript" type="text/javascript">
$(document).ready(function () {
jQuery("#waitDialog").dialog({
autoOpen: false,
modal: true,
height: 375,
position: 'center',
width: 400,
draggable: true,
closeOnEscape: false,
open: function (type, data) {
$(".ui-dialog-titlebar-close").hide();
$(this).parent().appendTo("form");
}
});
});
function showDialog(id) {
$('#' + id).dialog("open");
}
</script>
<div id="waitDialog" style="display:none; cursor: default">
<table class="ms-authoringcontrols" style="border-top:1px black solid; border:1px black solid; height:70px " >
<tbody>
<tr>
<td class="ms-sectionheader ms-rightAlign">
Please wait.
</td>
</tr>
</tbody>
</table>
</div>
<map name="Map">
<area shape="rect" coords="225,16,287,33" href="/_layouts/MyAlerts.aspx" onclick="javascript:showDialog('waitDialog');" alt="My Alerts">
</map>
您的链接的.click()
事件应该是return false
,这样它就不会被跟随,导致页面跳转到您的id
元素
$('a').click(function() {
showDialog($(this).attr('href'))
return false;
});
听起来你有锚标记的问题。代替href="/_layouts/MyAlerts.aspx"
可以使用:
onclick='window.location = "/_layouts/MyAlerts.aspx";
相关文章:
- 将视口底部滚动到元素底部
- 固定位置菜单时滚动,直到它击中一个相对容器的底部
- javascript跨浏览器确定用户是否滚动到页面底部
- javascript移动交叉浏览器确定用户是否滚动到页面底部
- 如何防止firefox在打开大型弹出窗口时滚动到页面底部
- 滚动到顶部或底部后的简单效果
- jQuery滚动到聊天框底部
- 如何仅在向上滚动时将页脚粘贴到窗口底部会导致页脚不显示
- 页面加载时自动滚动到底部
- 当滚动条到达容器底部时设置动画
- 表-滚动到底部
- 滚动至页面底部附近
- 刷新滚动到底部
- 在底部滚动
- jQuery在页面底部滚动时加载更多内容
- 自定义 DNN 皮肤无法检测到底部滚动,但它可以反向工作 (7.1.1)
- 如何从css中的UI中完全删除底部滚动条
- “看来More"按钮后每三个底部滚动使用jquery
- 无法可靠地检测 iPhone 纵向和横向模式之间的底部滚动
- AmCharts - 位置图表底部滚动条