Jquery:设置框架的宽度

标签 jquery css width attr

我正在尝试减小框架表的宽度,以便在我单击#circle2 按钮后右箭头的位置会发生变化。

$("#frame-table").css({"width":'30px'}) 不起作用。

#frame-table{
 position: absolute;
 width:634px;
 margin-left: 20px;
}

<div class="col-md-2" id="category"> 
    <center>
       <a href="#"><div class="img-circle" id="circle2">Mobile</div></a>         
    </center>
</div>    

<div class="col-md-7">   
    <div > 
        <table id = "frame-table">
            <tr>
                <td id = "left1">
                    <img src="img/left.png" alt = "left"/>
                </td>
                 <td id = "right1">
                     <img src="img/right.png" alt = "right"/>
                </td>
            </tr>
        </table> 
        <img class="img" src="img/web1.png" alt="Chania">  
    </div>

<div class="col-md-3">
</div>

$("#circle2").click(function(){ 
    $("#portfolio>li>img").each(function() {
        $(this).attr("src", $(this).attr("src").replace(/[^\/]*?(?=\d+.png)/, "mobile"));
    });
    $(".img").css({"width":'330px', 'height':'475px'}); 
    $(".img").attr("src", "img/mobile1.png"); 
    $("#category").after("<div class='col-md-2' id='space'></div>"); 
    $('.col-md-7').attr('class','col-md-5');
    //$("#frame").css({"width":'30px', 'height':'475px'}); 
    $("#frame-table").css({"width":'30px'});  
});

最佳答案

使用

 $('#frame-table').attr('width', 30);

关于Jquery:设置框架的宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29412936/

相关文章:

Css 全宽和滚动条问题

javascript - 检测页面大小并在宽度低于 500px 时更改 css

javascript - 使用jQuery将span内容替换为字段值

jquery - 在 jquery 数据表中使用 Ajax 进行分页

html - 自动从元素中删除未使用的 CSS 类

css - 可变大小表中的固定和可变大小列

php - WordPress - Breadcrumb NavXT 类别问题

javascript - 使用 css 顶部和左侧居中我的 div 时出现滚动条问题

android - 如何在 Android 应用程序电子邮件操作中使用内联样式?

html - 最大化 CSS 表格单元格宽度