2017-04-19 164 views
0

我的网站未全部载入内容。 这是它看起来应该像上CodePen:https://codepen.io/ArchivalBoat50/full/mWjRqK/网站并未加载全部内容

但是,这是它真正的样子: https://archivalboat50.github.io/marsproject/intro/

我检查了控制台,它说,它有一个HTTPS错误

这里是我的代码:

$(document).ready(function() { 
 
    setTimeout(function() { 
 
    $('.alpha').addClass('in'); 
 
    },1000) 
 
    $(".main-button").click(function(event) { 
 
    this.style.transform = "rotate(360deg)"; 
 
     
 
    }) 
 
})
@font-face { 
 
    font-family: 'agency'; 
 
    src: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/62921/agency_fb-2.eot'); /* IE9 Compat Modes */ 
 
    src: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/62921/agency_fb-2.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ 
 
     url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/62921/agency_fb-2.woff') format('woff'), /* Modern Browsers */ 
 
     url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/62921/agency_fb-2.ttf') format('truetype'), /* Safari, Android, iOS */ 
 
     url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/62921/agency_fb-2.svg#7adfd2e465e5a5494cfebbc2416928d9') format('svg'); /* Legacy iOS */ 
 
     
 
    font-style: normal; 
 
    font-weight: 400; 
 
} 
 

 

 
html { 
 
    font-size: 20px 
 
} 
 
body { 
 
    height: 100vh; 
 
    overflow: hidden; 
 
    background-color: #000; 
 
    background-image: url("http://www.newforestobservatory.com/wordpress/wp-content/gallery/starclusters/m56_hsiii_nfo.jpg") 
 
} 
 
.alpha { 
 
    position: absolute; 
 
    top: 50%; 
 
    left: 50%; 
 
    font-family: 'agency'; 
 
    text-transform: uppercase; 
 
    color: #fff; 
 
    font-weight: 100; 
 
    font-size: 5em; 
 
    transform-origin: center center; 
 
    transform: translate3d(-50%,-50%,0)scale(1.4); 
 
    opacity: 0; 
 
    transition: opacity 4s ease-out, transform 4s ease-out, letter-spacing 4s ease-out, -webkit-filter 3s ease-out, filter 3s ease-out; 
 
    filter: blur(20px); 
 
    -webkit-filter: blur(20px); 
 
    white-space: nowrap; 
 
    &.in { 
 
    transform: translate3d(-50%,-50%,0)scale(1); 
 
    letter-spacing: 0.1em; 
 
    opacity: 1; 
 
    filter: blur(0px); 
 
    -webkit-filter: blur(0px); 
 
    } 
 
} 
 

 
red-highlight { 
 
    background-color: rgba(255,0,3,0.3); 
 
} 
 

 
.mars { 
 
    width: 75%; 
 
    display: block; 
 
    position: absolute; 
 
    z-index: -1; 
 
    top: 50%; 
 
    left: 50%; 
 
    transform: translate(-50%, 0); 
 
    animation: mars 30s infinite linear; 
 
} 
 
@keyframes mars { 
 
    0% { 
 
    transform: translate(-50%, 0)rotate(0deg); 
 
    } 
 
    100% { 
 
    transform: translate(-50%, 0)rotate(360deg); 
 
    } 
 
} 
 

 
.center-element { 
 
    text-align: center; 
 
} 
 

 
.main-button { 
 
padding: 17px; 
 
background-color: rgba(0, 0, 0,0); 
 
border: 3px solid white; 
 
color: white; 
 
font-weight: bold; 
 
font-size: 16px; 
 
transition: background-color 0.5s, color .5s, transform 1s 
 
} 
 

 
.main-button:hover { 
 
    background-color: white; 
 
    color: black; 
 
    // transform: rotate(5deg) 
 
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<div class="alpha "> 
 
<h1> 
 
    Welcome to <span style="background-color:red;">Mars</span> 
 
    </h1> 
 
<div class="center-element"> 
 
<a href="https://archivalboat50.github.io/allpagesDavidsGMO/"> 
 
    <a href="https://codepen.io/ArchivalBoat50/full/gmQyZQ/" target="_blank"><button type ="button" class= "main-button">CLICK TO BEGIN AN AWESOME JOURNEY</button></a> 
 
    </a> 
 
    </div> 
 
</div> 
 
    <img class="mars" src="http://now.space/wp-content/themes/twentyfifteen/images/planets/mars.png" alt="" />

我该如何解决这个问题?

+2

Cross Origin问题..您正在从HTTPS请求文件,而您的网站仅为HTTP,请移除“s”或使用子资源完整性(SRI) – moped

+0

'http:// now.space'您混合了您的loading协议。 – zero298

回答

0

你应该让所有的链接https而不是http,chrome真的讨厌混合内容。简单的解决方案:在任何地方都可以将http更改为https。

2

如果你在你的实际网站的控制台上看,你会看到有关尝试加载一个不安全的脚本通过HTTP的错误,由于这个错误jquery从来没有拉进你的网站,意味着它一旦尝试运行一些jQuery代码。

它在codepen中起作用,因为它们已经从与它们相同的协议的源上拉取它。

1

你的错误:

  1. Mixed Content: The page at ' https://archivalboat50.github.io/marsproject/intro/ ' was loaded over HTTPS, but requested an insecure script ' http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js '. This request has been blocked; the content must be served over HTTPS.

就包括你的脚本:

<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>

并让服务器选择一个协议。这将解决另一个错误:

Uncaught ReferenceError: $ is not defined

  • 你在CSS多个错误,如:
  • Access to Font at ' https://s3-us-west-2.amazonaws.com/s.cdpn.io/62921/agency_fb-2.woff ' from origin 'null' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value ' https://s.codepen.io ' that is not equal to the supplied origin. Origin 'null' is therefore not allowed access.

    即使你包括他们为HTTPS你仍然违反CORS政策。您最好在您的网站上下载这些字体以避免这种情况。

    现在关于警告: 您有两个:

    Mixed Content: The page at ' https://archivalboat50.github.io/marsproject/intro/ ' was loaded over HTTPS, but requested an insecure image ' http://now.space/wp-content/themes/twentyfifteen/images/planets/mars.png '. This content should also be served over HTTPS.

    Mixed Content: The page at ' https://archivalboat50.github.io/marsproject/intro/ ' was loaded over HTTPS, but requested an insecure image ' http://www.newforestobservatory.com/wordpress/wp-content/gallery/starclusters/m56_hsiii_nfo.jpg '. This content should also be served over HTTPS.

    虽然没有错误,我建议您的网站上把这些图像,因为原始来源图像不提供安全连接。