Jquery UI对话框 - 打开时IE7浏览器立即移动到页面底部 [英] Jquery UI Dialog - when opened IE7 Browser moves instantly to the bottom of the page

查看:83
本文介绍了Jquery UI对话框 - 打开时IE7浏览器立即移动到页面底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在研究一个新的.net MVC网站,并集成了一些非常棒的jquery UI组件。

i have been working on a new .net MVC site and have integrated some of the awesome jquery UI components.

我一直在IE8,FF,歌剧中测试它和Chrome一起看起来都很好。一旦我在IE7中测试,令人惊讶的是它会导致出现问题的对话框。

ive been testing it in IE8, FF, opera and Chrome and all looks well. Once I test in IE7, surprisingly its the dialogs that are causing a problem.

基本上发生的是用户点击打开对话框,页面将立即滚动到页面底部。如果页面很长,这尤其糟糕。

basically what’s happening is that one you user clicks to open a dialog the page will scroll immediately to the bottom of the page. This is especially bad if the page is quite long.

这只发生在IE7中(可能只有6但我甚至不去那里!)。

this only happens in IE7 (and probably 6 but im not even going there!).

我花了几个小时阅读论坛,似乎我不是唯一一个。

I have spend a few hours reading forums and it seems im not the only one.

我创造了一个肮脏的黑客,我不是热衷但它确实有效。

I have created a dirty hack which im not keen on but it does work.

onclick="SignIn();  <% if(ModelHelperClass.CheckForOldIEVersion() == true) Response.Write("window.scrollTo(0, 0);"); %> return false;">

是否还有其他人遇到此问题并在不诉诸肮脏黑客的情况下解决了这个问题?

has anyone else had this issue and resolved it without resorting to dirty hacks ?

我正在使用jquery-ui-1.8.custom.min.js和jquery-1.4.2.min.js

im using jquery-ui-1.8.custom.min.js and jquery-1.4.2.min.js

任何帮助都是非常感谢

Truegilly

Truegilly

更新---

你好,感谢你的回复 -

hello, thanks for the response -

在我的页面顶部我有这个声明......

at the top of my page i have this declaration...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

我包含这些文件....

i am including these files....

<link href="/Scripts/css/blitzer/jquery-ui-1.7.2.custom.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/Scripts/jquery-1.4.2.min.js" ></script>
<script type="text/javascript" src="/Scripts/jquery-ui-1.8.1.custom.min.js" ></script>

这是我的登录功能 - 其他对话非常相似

here is my signin function - the other dialogs are pretty similar

// Sign in to the site
function SignIn() 
{
    $("#SignIn").dialog({
        bgiframe: true,
        modal: true,
        resizable: false,
        buttons: {

            'Sign In': function () {

                // the username and password
                var Username = $("#Username").val();
                var Password = $("#Password").val();

                var dataString = 'Username=' + Username + '&Password=' + Password;

                // AJAX here....

                // when the user clicks sign in, the form is submitted                
                //$("#SignInForm").submit();
            },
            Cancel: function () {
                $(this).dialog('close');
            }
        }
    });
}

正如我所说,它在除IE7之外的所有浏览器中都能正常工作

as i say, it works fine in all browsers except IE7

推荐答案

我已经解决了它删除了html代码中的逗号:

I've solved It removing a comma in the html code:

照看宽度:715

之前:

$(function(){
// Dialog           
$('#dialog').dialog({
autoOpen: false,
width: 715,});

之后:

$(function(){
// Dialog           
$('#dialog').dialog({
autoOpen: false,
width: 715
});

IE7报告了一个逗号行中的错误。

IE7 reported me an error in the line where there was a comma.

这篇关于Jquery UI对话框 - 打开时IE7浏览器立即移动到页面底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆