javascript - 框架7 : How to get page content-block-inner width and height (without navbar and toolbar)

标签 javascript jquery html css html-framework-7

如何获取页面内容 block 内部宽度和高度(没有导航栏和工具栏),因为它因设备和操作系统而异。

我尝试将 id 赋予 content-block-inner,然后使用 $$('#test').height;,但失败了。

<!-- Pages, because we need fixed-through navbar and toolbar, it has additional appropriate classes-->
<div class="pages navbar-through toolbar-through">
    <!-- Page, data-page contains page name-->
    <div data-page="index" class="page">
        <!-- Scrollable page content-->
        <div class="page-content">
            <div class="content-block" style="margin: 0px; padding: 0px;" id="test">
                <div class="content-block-inner" style="margin: 0px; padding: 0px;">
                    <div id="mypage" style="width:100%; height:80vh; margin: 0px; padding: 0px;">

                    </div>
                </div>

                <div class="toolbar" style="width:100%; margin: 0px; padding: 0px;" id="draw_toolbar">
                    <div class="toolbar-inner">
                        <i class="icon icon-bars" onclick="test()"></i>
                        <i class="icon icon-bars" onclick="test()"></i>
                        <i class="icon icon-bars" onclick="test()"></i>
                        <i class="icon icon-bars" onclick="test()"></i>
                        <i class="icon icon-bars" onclick="test()"></i>
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>

$$('#test').height的返回值;

function(){
    return this[0]===window?window.innerHeight:this.length>0>parseFloat
}

最佳答案

如果id="test",那么选择器应该是$$('#test')

在上面的示例中,散列 (#) 不存在。

关于javascript - 框架7 : How to get page content-block-inner width and height (without navbar and toolbar),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34646479/

相关文章:

javascript - jQuery/JS随机背景图解决::元素前

javascript - 无法更改 Chrome 扩展生成的 iframe 中的元素

jquery - 根据点击位置重新定位 div

java - 如何在jsp或html5的数据列表中添加复选框

javascript - AngularJS - 图像不在 ng-template 中呈现

javascript - ANSI 日期(COBOL 整数日期)到当前日期

javascript - 打印 CSS 类的属性列表

php - 为什么我的 JSON 对象的 AJAX 调用返回其特定内容未定义?

javascript - 从 firefox 扩展中检索网站的 favicon url

jquery - 如何将数组传递给jquery中的函数