gpt4 book ai didi

javascript - Codecademy 练习 : portfolio

转载 作者:行者123 更新时间:2023-11-28 07:11:56 24 4
gpt4 key购买 nike

我正在做 Codecademy 练习 portfolio我无法理解 Assets 管道位:练习的步骤 14,其中说明如下:

Save your JavaScript code to app/assets/javascripts/, and then include it the page as shown here(the link).

我所做的就是在该目录中创建 app.js 文件,并将我的 javascript 代码放入该文件中,以在 application.html.erb 中进行图像幻灯片放映和 jquery。我可以看到幻灯片,并且当我使用 heroku 部署应用程序时一切正常,我看不到幻灯片而不是所有图片。这是我到目前为止所做的链接:[Myapp][3]

我是 Rails 新手,所以如果有人能澄清指令期望我做什么以及如何在 heroku 中查看幻灯片,我将不胜感激。

$(function() {
$('.banner').unslider();
});
// Place all the styles related to the Pages controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

.header li {
display: inline-block;
position: relative;
padding: 20px;
font-size: 20px;
}

.header li a{
color: #333300;
}


.jumbotron {
background: url('https://dl.dropboxusercontent.com/s/5tug99ala22yzk2/19087585626_d16bace51e_k.jpg?dl=0') no-repeat center center fixed;
height: 700px;
}
.jumbotron h1{
font-size: 50px;

}

.jumbo{

background-color : #FFFFFF;
padding: 10px;

}

.btn-default {
position: relative;
display: inline-block;
color: white;
background-color: #333333;
font-family: Raleway, sans-serif;
font-size: 20px;
padding: 20px;

}

.supporting h3 {
position: relative;
text-align: center;

}

.supporting p {
position: relative;
text-align: center;

}


.banner { position: relative; overflow: auto;}
.banner li { list-style: none; }
.banner ul li { float: left;}
<!DOCTYPE html>
<html>
<head>
<title>Portfolio</title>
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,300,500,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>

<script src="//unslider.com/unslider.min.js"></script>
<%= csrf_meta_tags %>
</head>
<body>

<div class ="header">
<div class="nav nav-pills">
<div class="container">
<ul class ="pull-left">
<li><%= link_to "Welcome", root_path %></li>
<li><%= link_to "Portfolio", portfolio_path %></li>
<li><a href="#">Blog</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
<ul class="pull-right">
<li><a href="#">Mashuk</a></li>
</ul>
</div>
</div>
</div>

<%= yield %>


<div class="footer">

<div class="container">
<div class="pull-right">
<a href ="#"><img src ="https://dl.dropboxusercontent.com/s/14kntwgnr2bnegw/inspiration.svg?dl=0"></a>

<div><p>&copy; 2015 Mashuk</p>

<p>Icons made by <a href="http://www.flaticon.com/authors/freepik" title="Freepik">Freepik</a> from <a href="http://www.flaticon.com" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0">CC BY 3.0</a></p>

</div>
</div>

</div>
</div>
</body>
</html>

最佳答案

GET https://unslider.com/unslider.min.js net::ERR_INSECURE_RESPONSE

Unslider.com 不支持 HTTPS。

Heroku 应用程序在 HTTPS 上运行,并且由于您使用的是协议(protocol)相对链接 //unslider.com/unslider.min.js 它也会尝试通过 HTTPS 加载脚本。

最简单的解决方案是下载脚本并将其放置在 /vendor/assets/javascripts 中。

参见How do you instruct Sprockets to include files from /vendors/assets/components on Heroku?如果您想使用 sprocket 将文件包含在您的 application.js 中。

关于javascript - Codecademy 练习 : portfolio,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31219513/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com