`
javaliwei
  • 浏览: 13906 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

$(document).width() get different result between Chrome/FF and IE

阅读更多
When the web page is too long so that scrollbar shows up, $(document).width() will show different result between Chrome/FF and IE.
Chrome/FF will get the width without scrollbar's width, but IE will take  the scrollbar as one part of document.

If we want to calculate the absolute position of any element, it may be helpful.
1
5
分享到:
评论

相关推荐

    学习jQuery中的Ajax——$.get()方法

    在这个例子中,页面加载完成后,`$.get()`向'data.json'发送请求,当响应返回时,将JSON数据格式化后显示在id为'result'的div元素内。 ### 五、总结 jQuery的`$.get()`方法为开发人员提供了一种简单而有效的方式来...

    JS 读取Excel文件(xls) 兼容Chrome/IE/Firefox

    在JavaScript中,读取Excel文件(.xls)并兼容多种浏览器,如Chrome、IE和Firefox,是一项常见的需求。这通常涉及到文件API、ActiveXObject(针对IE)和第三方库的使用。下面将详细介绍如何实现这一功能。 首先,...

    jquery简单实现拖拽效果

    if ($draggableElement.position().left + $draggableElement.width() > $container.width()) { $draggableElement.css('left', $container.width() - $draggableElement.width()); } if ($draggableElement....

    JS,Jquery获取各种屏幕的宽度和高度

    3. **`$(document.body).height()`** 和 **`$(document.body).width()`**: - 返回文档body元素的高度和宽度,不包括任何滚动条。 4. **`$(document.body).outerHeight(true)`** 和 **`$(document.body)....

    各浏览器对document.getElementById等方法的实现差异解析

    - `document.write`和`document.writeln`在IE6/7/8中可以直接调用,而在其他浏览器中会抛出错误。这是因为这两个方法在非初始文档加载期间在其他浏览器中是不可用的。 - `location.reload`和`history.go`同样在IE6/7...

    javascript 获取当前面可视高度和宽度及浏览器宽度和高度的函数.docx

    - `document.documentElement.clientHeight` 和 `document.documentElement.clientWidth`:IE6 Strict模式下使用。 - `document.body.clientHeight` 和 `document.body.clientWidth`:其他IE版本和其他浏览器使用。 ...

    火狐、谷歌、IE关于document.body.scrollTop和document.documentElement.scrollTop 以及值为0的问题

    在探讨“火狐、谷歌、IE关于`document.body.scrollTop`和`document.documentElement.scrollTop`以及值为0的问题”这一主题时,我们深入分析了浏览器在处理页面滚动位置时的不同行为,尤其是当滚动位置值始终为0时的...

    获取页面长宽和滚动条的位置

    } else if(document.body.scrollHeight > document.body.offsetHeight) { // all but IE Mac scrW = document.body.scrollWidth; scrH = document.body.scrollHeight; } else if(document.body) { /...

    HTML抽取器Xsoup.zip

    ...同时Xsoup提供全面的XPath解析错误提示。... result = Xsoup.compile("//a/@href").evaluate(document).get(); Assert.assertEquals("https://github.com", result); } 标签:Xsoup

    图形jquery.gvChart-1.0.1.min.js

    $.print = $.fn.print = function () { // Print a given set of elements var options, $this, self = this; // console.log("Printing", this, arguments); if (self instanceof $) { // Get the node if it...

    document.frames在非IE浏览器中的解决办法

    然而,在实际应用过程中发现,`document.frames`这一属性在Internet Explorer(IE)浏览器中可以正常工作,但在其他非IE浏览器如Chrome、Firefox等中却无法正常使用。这主要是因为`document.frames`是IE特有的非标准...

    基于jQuery的音乐播放器源代码

    $.getJSON('lyrics.json', function(data) { var currentLyric = ''; $audio.on('timeupdate', function() { var currentTime = $audio[0].currentTime; for (var i = 0; i < data.lyrics.length; i++) { if ...

    JS中关于document.all的详解

    ### JS中关于`document.all`的详解 #### 一、`document.all`简介 `document.all` 是一个只读属性,它返回一个包含文档中所有元素的类数组对象。这个特性最初是为 Internet Explorer 设计的,并且在早期版本的 IE 中...

    最新dsoframer.ocx

    document.all.FramerControl1.CreateNew("Word.Document"); //新建Excel document.all.FramerControl1.CreateNew("Excel.Sheet"); /* 2.打开文件 */ //打开制定的本地文件 document.all.FramerControl1.Open("C:\\...

    26个Jquery使用小技巧

    if($.browser.chrome){ // do something } // Target Camino if($.browser.camino){ // do something } // Target Opera if($.browser.opera){ // do something } // Target IE6 and below if($....

    IE_FF兼容性

    - **FF**: FF不支持`document.all()`,而只能使用`document.getElementById()`来获取具有特定ID的元素。 **示例**: ```javascript if (document.all) { // IE var elem = document.all['myElement']; } else { ...

    jquery翻书效果

    //and then call the booklet plugin $mybook_images.each(function(){ var $img = $(this); var source = $img.attr('src'); $('<img/>').load(function(){ ++loaded; if(loaded == cnt_images){ $loading....

    解决iframe的frameborder在chrome/ff/ie下的差异

    代码如下: var iframe = document.createElement(“iframe”); iframe.id = “frame-” + index; iframe.src = url; iframe.width = “100%”; iframe.marginwidth = “0”; iframe.scrolling = “no”; iframe....

    org.openxmlformats.schemas.wordprocessingml.x2006

    编译tika源文件最难找的jar包,好像很多人都找不到,找了一天才找到

    iquery经典教程

    所有效果说明:基本的鼠标互动:拖拽(drag and dropping)、排序(sorting)、选择(selecting)、缩放(resizing) 各种互动效果:手风琴式的折叠菜单(accordions)、日历(date pickers)、对话框(dialogs)、滑动条 (sliders...

Global site tag (gtag.js) - Google Analytics