小编Seb*_*ian的帖子

选项卡导航 - 记住用户选择

我正在为我的子页面产品使用TAB导航 - > ?p=products(参见下面的代码,网站是用HTML和PHP实现的)

问题:

例如,用户在第二个TAB中单击链接详细信息.然后他使用后退按钮.现在他回到产品网站,但不是在第二个标签中,而是在第一个标签中.

href="#section-2"如果用户返回产品页面,我想记住上次使用的标签(此处:).

有谁知道我怎么能意识到这一点?

<div id="tabs" class="tabs">
    <nav>
        <ul>
            <li><a href="#section-1" class="icon-cross"><span>Product 1</span></a></li>
            <li><a href="#section-2" class="icon-cross"><span>Product 2</span></a></li>
            <li><a href="#section-3" class="icon-cross"><span>Product 3</span></a></li>
            <li><a href="#section-4" class="icon-cross"><span>Product 4</span></a></li>
        </ul>
    </nav>

    <div class="content">

        <section id="section-1">
            <div class="tab-heading">
                <hr>
                <h2 class="intro-text text-center"><strong>Product 1</strong></h2>
                <hr>
            </div>
            ...
        </section>

        <section id="section-2">
            <div class="tab-heading">
                <hr>
                <h2 class="intro-text text-center"><strong>Product 2</strong></h2>
                <hr>
            </div>

            <a href="?p=details">Details</a>

        </section>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

html php

19
推荐指数
1
解决办法
656
查看次数

如何从文档中删除字段

数据库架构:

{
    _id: "kun2",
    result150160: [10,20,30];
    moon: 4
}
Run Code Online (Sandbox Code Playgroud)

我想用一个变量删除客户端的整个字段result150160:

var deleteresult = "result150160"
Box.update( {_id: this._id} , {$unset: { deleteresult } } );
Run Code Online (Sandbox Code Playgroud)

mongodb meteor

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

与流星一起工作.htaccess?

是否可以将.htaccess和.htpasswd与流星应用程序一起使用?

如果我在xyz.meteor.com上部署我的应用程序,我可以使用它吗?

我在xyz.meteor.com上尝试过,但它不起作用:

AuthUserFile /meteor/.htpasswd
AuthGroupFile /dev/null
AuthName "Password"
AuthType Basic
<Limit GET>
require valid-user
</Limit>
Run Code Online (Sandbox Code Playgroud)

.htaccess meteor

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

将变量从JavaScript传递到PHP并重新加载DIV/iframe

我有一个网站,其中包含DIV中的iframe.iframe的宽度应取决于浏览器的宽度.

因此我使用JavaScript函数和EventListener来获取浏览器的宽度.这很好.

现在我必须将确定的宽度从JavaScript传递到我的iframe并重新加载它.这是我的HTML/PHP代码与index.html的iframe :

<div id="scout">
    <?php
        $iframeWidth = "<script>document.write(iframeWidthFromJS)</script>";
        echo "iframe width is " . $iframeWidth;
    ?>

    <iframe src="http://cpcms.scout" width="<?php echo $iframeWidth; ?>" height="600"></iframe>
</div>
Run Code Online (Sandbox Code Playgroud)

这是我的JavaScript,它不起作用:

window.addEventListener('resize', getWindowSize);
window.onload(getWindowSize());

function getWindowSize()
{
    var iframeWidthFromJS = 800;

    if (typeof (window.innerWidth) == 'number')
    {
        // Get current browser width
        width = window.innerWidth;
        iframeWidthFromJS = width;

        alert(iframeWidthFromJS);

        // Reload the DIV to apply new iframe width
        $( "#scout" ).load(window.location.href + " #scout" );
    }
}
Run Code Online (Sandbox Code Playgroud)

确定宽度有效,但不会将其传递给iframe.

html javascript css php jquery

0
推荐指数
1
解决办法
62
查看次数

标签 统计

html ×2

meteor ×2

php ×2

.htaccess ×1

css ×1

javascript ×1

jquery ×1

mongodb ×1