首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >respond.js设置教程

respond.js设置教程
EN

Stack Overflow用户
提问于 2014-02-19 19:19:46
回答 1查看 8K关注 0票数 2

我在任何地方都找不到关于如何设置respond.js的信息。

我打开了htdocs -这是对的吗?还是我只需要htdocs中的respond.min.js?

然后像这样引用这个文件..。

代码语言:javascript
复制
<script src="respond.min.js"></script>

目前,我已经在我的头部分,尝试了之前和之后的媒体查询,但没有使用样式表。

是否有关于如何设置resonse.js的教程,因为我不知道我是否做错了什么,或者是否有其他问题。

任何帮助都将是非常感谢的,我的网站终于完成了,但是我不希望它在没有媒体查询的情况下运行,而且目前如果我使用媒体查询,在IE8中根本不会加载任何触笔表。

谢谢

这是我目前的代码;

代码语言:javascript
复制
<!DOCTYPE HTML>
<html lang="en">
    <head>
            <!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
 <script src="http://localhost/respond.min.js"></script>
<![endif]-->

        <meta charset="UTF-8">
            <link type="text/css" rel="stylesheet"  media="screen and (min-device-width:600px) and (max-device-width:1024px)" href="http://localhost/oldScreen.css">
            <link type="text/css" rel="stylesheet"  media="screen and (min-device-width:1025px)" href="http://localhost/home.css">


                <title>Eastbourne Netball League[Home] </title>
    </head>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-02-19 20:11:29

好的,由于文件已经加载,问题必须来自以下两点之一:

从文件中:

  • 使用最小/最大宽度的媒体查询制作CSS,以调整从移动(第一)到桌面@媒体屏幕的布局和(最小宽度:480 go ){ ...styles for 480 go和up go here }
  • 引用respond.min.js脚本(1kb min/gzipped),在所有CSS之后(运行越早,IE用户就越不可能看到非媒体的内容)。

我猜是第二点:)

希望能帮上忙。

编辑

代码语言:javascript
复制
    <meta charset="UTF-8">
    <link type="text/css" rel="stylesheet"  media="screen and (min-width:600px) and (max-width:1024px)" href="http://localhost/oldScreen.css">
    <link type="text/css" rel="stylesheet"  media="screen and (min-width:1025px)" href="http://localhost/home.css">

    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <script src="http://localhost/respond.min.js"></script>
    <![endif]-->

    <title>Eastbourne Netball League[Home] </title>
</head>

如果这不起作用,请将其放在CSS文件中:

代码语言:javascript
复制
@media {min-width:600px) and (max-width:1024px) {

    /* your css here */

}

@media {min-width:1025px) {

    /* your css here */

}

因此,您甚至可以将所有CSS放在同一个文件中。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21890235

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档