嗨,在过去5天尝试使用后伸时没有加载图像的问题.检查我的所有文件路径,使用正确的库插件,检查标记的顺序,检查脚本的顺序.有任何想法吗?请帮忙!非常感谢 - 并为成为新手而道歉.
这是我的代码:
<!DOCTYPE html>
<html lang="en">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<head profile="http://gmpg.org/xfn/11">
<link rel="stylesheet" href="new_website/new_site_css/stylesheet2.css" type="text/css" media="screen" title="CSS" charset="utf-8" />
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
</head>
<body>
<script type="text/javascript"
<script type="text/javascript"src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript"src="new_website/jquery.backstretch.js"></script>
<script>
$.backstretch([
"new_website/images/2.png",
"new_website/images/3.png",
"new_website/images/4.png"
], {duration: 4000, fade: 750});
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我没有宣布任何css,仅供参考.非常感谢!
我在我的网站上使用backstretch.现在尝试从左到右自动移动背景幕.但直到现在,它只是向一个方向移动.我期待着那个动态图像的连续循环.
如何重置/移回图像?
backstretch.js:http://dev.disaster-kfw.com/fileadmin/template/js/slidebackground.js
一些更多的javascript用于移动效果和初始化
var images = ['fileadmin/template/gfx/background02-03.jpg'];
jQuery.backstretch( images[Math.floor(Math.random() * images.length)] );
jQuery(function($){
(function swoop(element) {
element
.animate({'margin-left':'-=5px'}, 100, function(){
setTimeout(function(){
swoop(element);
}, 0);
});
})($('#backstretch img'));
});
Run Code Online (Sandbox Code Playgroud)
产生这个HTML输出
<div id="backstretch" style="left: 0px; top: 0px; position: fixed; overflow: hidden; z-index: -999999; margin: 0px; padding: 0px; height: 100%; width: 100%;"><img src="fileadmin/template/gfx/background02-03.jpg" style="position: absolute; margin: 0px 0px 0px -3404.98890491151px; padding: 0px; border: none; z-index: -999999; width: 3006px; height: 835px; left: -551.5px; top: 0px;"></div>
Run Code Online (Sandbox Code Playgroud)
对不起发布html代码有点难看,不知道做对了...
编辑:
非常感谢,但我认为这不是我需要的.
我想我需要一个关于图像宽度和左边距的计算,以便从左移动到右移动和后移动.
所以我试着计算我的图像的宽度,但是 …