小编chr*_*ris的帖子

Modal是"记住"以前模态中的代码

设置
我有一个盒子网格(模态触发器).每个方框打开一个模态.每个模态内部都是一个非常简单的缩略图库,其中包含一个主图像和缩略图.单击缩略图会将主图像替换为自身的较大版本.

问题(这个序列中的第4步......)
(1)打开模态A,主图像显示 - 太棒了!
(2)单击模态A中的第二个拇指,主图像变为该拇指的较大版本 - 太棒了!
(3)关闭模态A - 太棒了!
(4)打开模态B,主图像不是模态B的第一个拇指,但它是模态B的第二个缩略图的较大图像 - 不是那么大!莫代尔B记得我从模态A中选择了第二个拇指,所以它显示的是模态B的第二个拇指而不是第一个拇指.

问题
我如何(以及在​​哪里)添加代码,以便模态"忘记"在最后一个模态中选择的内容?或者每次打开模态时重置?如果我选择模态A的第3张图像,但打开模态B并且它没有第3张缩略图,则此问题非常严重 - 因为主图像将为空白.我是否将代码应用于模态或库jquery?这让我疯狂!


MODAL PLUGIN
custombox.js

THUMBNAIL PLUGIN
simplegallery.js

JQUERY FIRE MODAL

$(document).ready(function () {
    $(".modal img").not(":visible").each(function () {
        $(this).data("src", this.src);
        this.src = "";
    });
    $(".modal").each(function () {
        $(this).data("sourcesAreSet", false);
    });
    $('.info').on('click', function (e) {
        var correspondingModal = $($(this).data('href'));
        if (correspondingModal.data("sourcesAreSet") == false) {
            correspondingModal.find("img").each(function () {
                this.src = $(this).data("src");
            });
            correspondingModal.data("sourcesAreSet", true);
        }
        Custombox.open({
            target: $(this).data('href'),
            effect: 'push',
            speed: 500,
            overlayColor: '#2C3E50', …
Run Code Online (Sandbox Code Playgroud)

jquery modal-dialog thumbnails image-gallery

10
推荐指数
1
解决办法
339
查看次数

<head> 中的 Google 字体还是带有 @import 的 CSS?

(我是新来的所以如果这不是问它的地方,请告诉我)

通常我添加<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400,400italic,700' rel='stylesheet' type='text/css'><head>我的页面。对于多个页面,总是有可能出现不一致/错误,而且更新每个页面可能会令人头疼。

Can I instead just use @import url(http://fonts.googleapis.com/css?family=Open+Sans); at the first line of my main CSS file?

Advantage to this is updating one CSS file rather than updating every single page where it's in the <head>. But I've read some answers that say there may be a resource loading problem...but that discussion was 3 years ago. Can't find a current answer addressing this.

EDIT
To avoid SO from thinking this is …

html css fonts google-font-api

5
推荐指数
1
解决办法
3873
查看次数

获得 SSL,现在所有请求的文件都被阻止(混合内容)

我有客户在我提供的页面上使用 HTML。该 HTML 链接到我服务器上的文件(JS、CSS、图像等)。

我给他们的例子:
<link type="text/css" rel="stylesheet" href="http://www.example.org/this.css" />

我刚刚获得了 SSL,所以我的网站现在是 http s。然而,当从我的服务器请求文件时,我给他们的服务器上的 HTML 仍然是 http。

因此,他们收到混合内容警告并且内容被阻止。像这样:

混合内容:“ https://www.example.org/ ”上的页面通过 HTTPS 加载,但请求了不安全的样式表“ http://www.example.org/file.css ”。此请求已被阻止;内容必须通过 HTTPS 提供。

我不能让我的所有客户将他们所有页面上的所有链接都更改为“http s ”,以便防止警告/阻塞。那将是一场噩梦。

我的主人是 GoDaddy。我的服务器是 Windows 服务器,IIS:7.0,ASP.Net 运行时版本:4.0/4.5。

我怎样才能通过 web.config 解决这个问题?我目前的规则是:

<configuration>
<system.webServer>
    <rewrite>
        <rules>
            <rule name="HTTP to HTTPS redirect" stopProcessing="true">
                <match url="(.*)" />
                <conditions>
                    <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                </conditions>
                <action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)

我想要发生的是允许所有外部 http 请求到我的 https 服务器。

谢谢!

html windows ssl web-config mixed-content

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

.class a:hover vs .class:hover a

无法找到我一直想知道的答案.

有没有之间的差异.class2 a:hover {}.class2:hover a {}?或者偏爱一个而不是另一个?

我一直.class2 a:hover {}用来改变锚悬停上的锚点(即:锚文本颜色),但是当我想改变持有锚点的div时(即:锚点颜色和div背景颜色都在悬停时改变),我不得不用.class2:hover a {}它来工作.在这样做的时候,我对两者之间的区别感到困惑,因为它们之间的编写方式非常相似.

谢谢!

编辑
编辑问题更清楚.谢谢你解开我的大脑:)

css hover

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