我刚刚在 Heroku 上部署了一个 Django 应用程序 - http://enigmatic-castle-9385.herokuapp.com/
我对页面顶部的永久链接有疑问。当我从家导航到任何页面时,导航链接变得无响应。似乎有 50% 的时间发生。在 Firefox 中,导航在某些页面上完全消失。我很确定这是由于 jQuery 脚本,因为禁用时,链接正常工作。我在本地没有看到任何这些问题,只是在部署的站点上。
我有一个基本 HTML:
{% load staticfiles %}
<html>
<head>
<link rel="stylesheet" type="text/css" href="{% static 'main.css' %}"/>
<link rel="shortcut icon" href="{% static 'logo.png' %}" type="image/png">
<title>Hannah Young Photography</title>
</head>
<body>
<div>
<a href="/"><img class = "logo" src = "{% static 'logo.png' %}"/></a>
<p class = "topnav-white-header">
Hannah Harley Young is a party & event photographer based in London. She shoots mainly high profile events, but also commissioned for private parties as well as portrait
</p>
<ul class = "navigation-bar">
<li><a href="/contact" class = "nav-link">CONTACT</a></li>
<li><a href="/clients" class = "nav-link">CLIENTS</a></li>
<li><a href="/personal" class = "nav-link">PERSONAL</a></li>
<li><a href="/fashion" class = "nav-link">FASHION</a></li>
<li><a href="/portrait" class = "nav-link">PORTRAITS</a></li>
<li><a href="/party" class = "nav-link">PARTIES</a></li>
</ul>
<div>
{% block image %}
{% endblock %}
</div>
</body>
</html>
图库页面(派对、肖像、时尚、个人链接都具有相同的结构)如下所示:
{% extends "base.html" %}
{% load staticfiles %}
<html>
<head>
<link rel="stylesheet" type="text/css" href="{% static 'main.css' %}"/>
</head>
<body>
{% block image %}
<script type = "text/javascript" src = "http://code.jquery.com/jquery-1.8.0.min.js"></script>
<script type = "text/javascript" src = "{% static 'jquery.cycle.all.js' %}"></script>
<script type = "text/javascript">
$(document).ready(function(){
$(".slideshow")
.cycle({
fx: 'scrollHorz',
next: '.right-arrow',
prev: '.left-arrow',
timeout: 0,
pager: '.slide-nav',
pagerAnchorBuilder: function paginate(idx, el) {
return '<a class="bullet" href="#" >•</a>'
}
})
})
$(document).ready(function(){
$(".left-arrow").hover(function() {
$(this).attr("src","{% static 'left-arrow-blue.png' %}");
}, function() {
$(this).attr("src","{% static 'left-arrow.png' %}");
});
});
$(document).ready(function(){
$(".right-arrow").hover(function() {
$(this).attr("src","{% static 'right-arrow-blue.png' %}");
}, function() {
$(this).attr("src","{% static 'right-arrow.png' %}");
});
});
</script>
<img class = "right-arrow" src = "{% static 'right-arrow.png' %}">
<img class = "left-arrow" src = "{% static 'left-arrow.png' %}">
<div class = "slideshow">
{% for photo in gallery %}
<div class = "slide">
<img class = "gallery-image" src ="{{ photo.image.url }}"/>
<div class = "caption-container">
{% for client in photo.client.all %}
<div class = "client">client: {{ client.name }}
<div class = "slide-nav"></div>
</div>
{% endfor %}
<span class = "caption">{{ photo.caption }}</span>
</div>
</div>
{% endfor %}
</div>
{% endblock %}
</body>
</html>