小编mcs*_*rep的帖子

如何在CSS中获取当前的屏幕宽度?

当屏幕宽度小于480px时,我使用以下CSS代码进行格式化,并且它运行良好.

@media screen and (min-width: 480px) {
    body {
        background-color: lightgreen;
    }
}
Run Code Online (Sandbox Code Playgroud)

我想得到当前的计算宽度,zoom如下所示:

@media screen and (min-width: 480px) {
    body {
        background-color: lightgreen;
        zoom: (current screen width)/(480);
    }
}
Run Code Online (Sandbox Code Playgroud)

html css css3

12
推荐指数
3
解决办法
7万
查看次数

图像未从Dropbox检索

嗨!我有一个图像滑块.当我尝试从我的服务器检索图像时,图像被正确显示.(http://stthomasmountmtc.org/index.html)

但是,当我尝试从Dropbox检索相同的图像时,不会显示/检索图像.(http://stthomasmountmtc.org/index1.html)

 <img src="https://www.dropbox.com/s/woart55urbw792u/image1.jpg" alt="image" />
Run Code Online (Sandbox Code Playgroud)

当我src在浏览器中打开属性中的链接时,可以看到图像,因此链接显然没有被破坏.请分享您的建议.

谢谢Samuel Mathews.

html image src dropbox

5
推荐指数
2
解决办法
7335
查看次数

如何从关键字搜索中返回最短的片段?

我有以下任务要解决:

给定一页包含字母数字单词的内容,以及一个包含 N 个单词的搜索短语,编写一个算法,该算法将返回包含所有 N 个单词的最短内容片段(以任何顺序排列)。

这是我到目前为止。我将页面上的文本放入一个没有标点符号的数组中:

var allText = $('#all-text').text();
var punctuationless = allText.replace(/[^A-Za-z0-9_]/g," ").toLowerCase();
var lessSpaces = punctuationless.replace(/\s{2,}/g," ");
var allTextArray = lessSpaces.split(" ");
var keywords = [];
Run Code Online (Sandbox Code Playgroud)

我想我可以使用 .filter 方法,但我不确定如何比较两个数组。

allTextArray.filter(keywords)
//find the indexes of the matches to the keywords
//compare how far apart the indexes are to each other and return the shortest length
Run Code Online (Sandbox Code Playgroud)

javascript

5
推荐指数
0
解决办法
279
查看次数

标签 统计

html ×2

css ×1

css3 ×1

dropbox ×1

image ×1

javascript ×1

src ×1