前言:我可耻地不擅长这些东西
好的,所以我想在 div 上使用 Jparallax,但我无法让它工作。一旦演示工作,我将对其进行修改,但现在我什至可以做到这一点。我已经从演示中复制了#parallax 的css,链接了头部的.js,并复制了脚本以激活头部的#parallax,但是由于某种原因该div 没有激活。
我的 html
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Portal</title>
<link href='http://fonts.googleapis.com/css?family=Jura:400,300,500,600'rel='stylesheet' type='text/css'>
<link href="portalcss.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="dropdown.css" type="text/css" />
<script type="text/javascript" src="jquery.jparallax.js"></script>
<script type="text/javascript" src="dropdown.js"></script>
<script type="text/javascript">
window.onload = maxWindow;
function maxWindow() {
window.moveTo(0, 0);
if (document.all) {
top.window.resizeTo(screen.availWidth, screen.availHeight);
}
else if (document.layers || document.getElementById) {
if (top.window.outerHeight < screen.availHeight || top.window.outerWidth < screen.availWidth) {
top.window.outerHeight = screen.availHeight;
top.window.outerWidth = screen.availWidth;
}
}
}
</script>
<script type="text/javascript">
<!--
// jQuery.noConflict();
// RUN
var corners = '<img src="images/corner_dark_tl.png" class="tl" />'+
'<img src="images/corner_dark_tr.png" class="tr" />'+
'<img src="images/corner_dark_bl.png" class="bl" />'+
'<img src="images/corner_dark_br.png" class="br" />';
jQuery(document).ready(function(){
jQuery('h1').html('<img src="images/logo_stephband_grey.png" />');
jQuery('#parallax').jparallax().append(corners);
});
//-->
</script>
</head>
<body>
<div id="parallax">
<img src="0.png" alt="" style="width:978px; height:325px;"/>
<img src="1.png" alt="" style="width:987px; height:328px;"/>
<img src="2.png" alt="" style="width:1001px; height:333px;"/>
<img src="3.png" alt="" style="width:1031px; height:343px;"/>
<img src="4.png" alt="" style="width:1067px; height:355px;"/>
<img src="5.png" alt="" style="width:1120px; height:373px;"/>
<img src="6.png" alt="" style="width:1200px; height:400px;"/>
</div>
这是我的CSS#
#parallax
{
background:#2f3134;
position:relative;
overflow:hidden;
width:60em;
height:300px;
margin:1.5em 0;
}
这一切都是从这个演示中直接撕下来的 这个演示非常 感谢任何帮助