javascript skel.js 框架/HTML5UP 模板 CSS 问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19520865/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 15:52:07  来源:igfitidea点击:

skel.js Framework / HTML5UP Template CSS issues

javascriptphphtmlcssskel

提问by eklassen

I'm new to the skel.js framework and I'm having some issues.

我是 skel.js 框架的新手,但遇到了一些问题。

I downloaded a template from HTML5UP.net (Zerofour theme) and I have modified it all for my site however the CSS doesn't show up properly on my no-sidebar& left-sidebarpages.

我从 HTML5UP.net(Zerofour 主题)下载了一个模板,我已经为我的网站修改了所有模板,但是 CSS 没有正确显示在我的无侧边栏左侧边栏页面上。

I have an include with the follwing links (identical to their templates):

我有一个包含以下链接(与其模板相同):

    <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,700,800"         rel="stylesheet" type="text/css" />

    <script src="http://www.**********.com/js/jquery.min.js"></script>
    <script src="http://www.**********.com/js/jquery.dropotron.js"></script>
    <script src="http://www.**********.com/js/config.js"></script>
    <script src="http://www.**********.com/js/skel.min.js"></script>
    <script src="http://www.**********.com/js/skel-panels.min.js"></script>

    <noscript>
        <link rel="stylesheet" href="http://www.*********.com/css/skel-noscript.css" />
        <link rel="stylesheet" href="http://www.*********.com/css/style.css" />
        <link rel="stylesheet" href="http://www.*********.com/css/style-desktop.css" />
    </noscript> 

If I bypass the noscript the webpage appears as it should but loses ALL mobile and flowable capabilites.

如果我绕过 noscript,网页会按原样显示,但会丢失所有移动和可流动的功能。

Any ideas would be much appreciated!

任何想法将不胜感激!

Addon: If I move my pages to the root directory and update the links then the CSS works but in their child directories only the basic layout works.

插件:如果我将我的页面移动到根目录并更新链接,那么 CSS 可以工作,但在它们的子目录中只有基本布局可以工作。

    <?php
    define(currentDIR,'../');
    include (currentDIR.'includes/_functions.php');
    ?>
    <html>
<head>
    <?php include(currentDIR.'includes/_metalinks.php'); ?> //This is where the code above is stored
</head>

回答by emilyemorehouse

I also came across this issue while using an HTML5up template with Django. If you are using a different directory configuration for your static files, you must specify this in either the init.js or config.js file (the exact file depends on which template you are using and how recently it has been updated). For me, I had to modify the following skelJS prefix in the init.js file:

我在 Django 中使用 HTML5up 模板时也遇到了这个问题。如果您为静态文件使用不同的目录配置,您必须在 init.js 或 config.js 文件中指定它(确切的文件取决于您使用的模板以及它最近更新的时间)。对我来说,我必须在 init.js 文件中修改以下 skelJS 前缀:

    var helios_settings = {
        // other settings here

        skelJS: {prefix: '/static/css/style',

        // other settings here
        }

Basically, this directory prefix needs to match wherever you have your static files.

基本上,无论您拥有静态文件,此目录前缀都需要匹配。

回答by anto0522

I think you forgot to add

我想你忘了添加

        <link rel="stylesheet" href="css/style-noscript.css" />

回答by Sina Motamedi

I ran into the same issue and was able to fix it by modifying the config.js file to use the absolute path as follows:

我遇到了同样的问题,并能够通过修改 config.js 文件使用绝对路径来修复它,如下所示:

prefix: '/css/style',

Now files in both the root and other directories maintain the styling throughout.

现在根目录和其他目录中的文件始终保持样式。