标签: width

如何使用JQuery动态获取Body元素高度

当我调整浏览器窗口大小时,我需要获取body元素的高度和宽度

请帮我用JQuery解决这个问题

browser jquery height resize width

4
推荐指数
1
解决办法
6712
查看次数

使用jQueryUI时设置单选按钮的宽度

我正在使用jQuery UI单选按钮,并且无法找到如何将它们全部设置为固定宽度.

我正在使用的代码是:

<script type="text/javascript">
    $(document).ready(function () {
        $("#radio").buttonset();
    });
</script>

<div id="radio">
    <input type="radio" id="radio1" name="radio" /><label for="radio1">A</label>
    <input type="radio" id="radio2" name="radio" checked="checked" /><label for="radio2">Choice 2 - long long</label>
    <input type="radio" id="radio3" name="radio" /><label for="radio3">Choice 3</label>
</div>
Run Code Online (Sandbox Code Playgroud)

我是第一次使用jQuery,并且没有CSS或javascript经验.我已经尝试了各种奇怪的组合来尝试为按钮指定一个固定的宽度而不会丢失jQuery UI样式,但是没有运气.

任何帮助,将不胜感激.

jquery-ui width jquery-ui-button

4
推荐指数
1
解决办法
6988
查看次数

通过attributes.getNamedItem获取元素的实际widh/height值


我想在dom树(HTML页面)中获取元素的宽度/高度值,我使用下面的方法:

var event = e || window.event;
var target = event.target || event.srcElement;

我通过使用获得id和类信息

var classinfo = target.attributes.getNamedItem("class").nodeValue;
var idinfo = target.attributes.getNamedItem("id").nodeValue;

但是你可以猜到,任何元素都没有必须有id和/或类节点所以我不能检查width =".. px"节点值或getElementById方法
因此,有没有办法获得宽度和通过使用getNamedItem方法/或您可以建议的任何其他方法,节点元素的高度值.
注意:我需要获得真正的宽度和高度而不是css或内联,因为css中的宽度可能是60%但是它呈现为100px ...
提前感谢.

javascript height dom width

4
推荐指数
1
解决办法
9841
查看次数

如果浏览器宽度大于1000px,则显示图像

是否有可能获得浏览器Web视图的宽度并在其大于1000px时对其进行操作?

示例(伪代码):如果浏览器宽度大于1000px;

<div style="position:fixed; top:0; left:0; z-index:1; visibility:visible;">
<img src="images/borderleft.png">
</div>
Run Code Online (Sandbox Code Playgroud)

javascript browser width

4
推荐指数
1
解决办法
2万
查看次数

使用jQuery查找完整显示项目所需的最小宽度?

是否可以找到完全显示div所需的像素数?

现在,我的div是100%,但我真的希望它与内容一样小......(不能使用花车或其他css技巧).

css jquery width

4
推荐指数
1
解决办法
1891
查看次数

2012年首选的布局宽度

我正在研究新的网络应用程序,仍然无法决定,我应该选择的布局宽度.该应用程序基于Twitter Bootstrap的库,目前我使用默认网格系统(12列),宽度为1170px.

在显示器上(我假设大多数人的宽度分辨率高于1280像素)看起来应用不错,在我的MacBook PRO上也一样,但是我担心用户有点旧的笔记本电脑,其宽度 - 分辨率大多是1024px,并没有看到整个布局(并将看到水平滚动条).

所以,我想问你的意见.您是否优化了分辨率> 1280px的布局,或者您仍然使用res来反映用户.1024px并在这种情况下使用宽度960px为您的布局?

html css layout width screen-resolution

4
推荐指数
1
解决办法
3605
查看次数

传递一定宽度时重新加载页面

我希望只有在浏览器窗口高于或低于768px时才重新加载页面.这是我失败的尝试.

if ($(window.width() > "769") {
    $(window).resize(function () {
        if ($(window).width() < "769") {
            location.reload();
        }
    });

}
elseif($(window.width() < "769") {

    $(window).resize(function () {
        if ($(window).width() > "769") {
            location.reload();
        }
    });

}
Run Code Online (Sandbox Code Playgroud)

我确实这是一个非常简单的方法.

javascript browser jquery window width

4
推荐指数
1
解决办法
4283
查看次数

jQuery Window Width else if语句

我想知道为什么我的最后一个if语句永远不会执行.我想这样做:

$(document).ready(function() {
    function checkWidth() {
        var windowSize = $(window).width();

        if (windowSize <= 479) {
            console.log("screen width is less than 480");
        }
        else if (windowSize = 480 && windowSize <= 719) {
            console.log("screen width is less than 720 but greater than or equal to 480");
        }
        else if (windowSize = 720 && windowSize <= 959) {
            console.log("screen width is less than 960 but greater than or equal to 720");
        }
        else if (windowSize >= 960) {
            console.log("screen width is greater …
Run Code Online (Sandbox Code Playgroud)

jquery if-statement window width

4
推荐指数
1
解决办法
4万
查看次数

Twitter引导程序 - 更改默认宽度

我刚开始使用twitter bootstrap,想知道将默认宽度从940px更改为864px的最佳方法是什么.我尝试使用自定义页面将@gridColumnWidth变量更改为50px.这应该使总宽度为820px,但下载后默认宽度仅调整为1170px.我应该保留默认值为940px并在我的.row> .span12 div中嵌入宽度为864px的div吗?

我也尝试使用较少的文件但是当我尝试将它们编译为css文件时,我得到的错误表明类,id和变量是未定义的.

谢谢你的帮助,

贾森

css width less twitter-bootstrap

4
推荐指数
1
解决办法
1万
查看次数

Android RelativeLayout和子元素,layout_width ="match_parent"

当我在同一个"行"有两个视图时,Android如何计算视图的大小,一个宽度="fill_parent"?

例:

<RelativeLayout  
    xmlns:android="http://schemas.android.com/apk/res/android"  
    android:layout_height="fill_parent"  
    android:layout_width="fill_parent">  
    <EditText  
        android:id="@+id/EditText01"  
        android:hint="Enter some text..."  
        android:layout_alignParentLeft="true"  
        android:layout_width="match_parent"  
        android:layout_toLeftOf="@+id/Button01"  
        android:layout_height="wrap_content"></EditText>  
    <Button  
        android:id="@+id/Button01"  
        android:text="Press Here!"  
        android:layout_width="wrap_content"  
        android:layout_alignParentRight="true"  
        android:layout_height="wrap_content"></Button>  
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

此代码为EditText提供所有可用空间,并在其右侧显示按钮.但是,通过此更改,EditText将填充所有宽度,按钮不在屏幕上:

<RelativeLayout  
    xmlns:android="http://schemas.android.com/apk/res/android"  
    android:layout_height="fill_parent"  
    android:layout_width="fill_parent">  
    <EditText  
        android:id="@+id/EditText01"  
        android:hint="Enter some text..."  
        android:layout_alignParentLeft="true"  
        android:layout_width="match_parent"  
        android:layout_height="wrap_content"></EditText>  
    <Button  
        android:id="@+id/Button01"  
        android:text="Press Here!"  
        android:layout_width="wrap_content"  
    android:layout_toRightOf="@+id/EditText01"
        android:layout_height="wrap_content"></Button>  
</RelativeLayout
Run Code Online (Sandbox Code Playgroud)

android parent match width relativelayout

4
推荐指数
1
解决办法
3856
查看次数