html - 试图制作一个包含多个图像的永无止境的图像滚动器,但我被卡住了,有什么提示吗?

标签 html css image scroller

我正在与我的同事一起更新网站,我们有一个很棒的想法,让我们的赞助商在屏幕底部滚动,以便更容易地看到所有这些,并使它看起来比以前更整洁设计。问题是,我们还没有弄清楚如何让图像在同一行上滚动。我们目前正在使用 HTML5 和 CSS 来尝试解决这个问题,但没有成功。我试图按照某人发布的很棒的教程进行操作,但它是在 HTML5 之前制作的,因此似乎不起作用,这就是我正在关注的 https://designshack.net/articles/css/infinitephotobanner/我当然可能会错穿数字,所以我需要一些解释。稍后我会包含我的代码,看看是否有人能看到我的错误并纠正我,我需要一双更有经验的眼睛。奇怪的是,它似乎几乎可以在这里工作,但它对我的网页根本不起作用。有什么建议么?这些图像都出现在不同的行上,只有最上面的一个在滚动。

style.css
/*body and container*/

* {
  margin: 0;
  padding: 0;
}

body {
  background: url('dark_geometric.png');
}

#container {
  width: 1000px;
  overflow: hidden;
  margin: 50px auto;
  background: white;
}


/*header*/

header {
  width: 800px;
  margin: 40px auto;
}

header h1 {
  text-align: center;
  font: 100 60px/1.5 Helvetica, Verdana, sans-serif;
}

header p {
  font: 100 15px/1.5 Helvetica, Verdana, sans-serif;
  text-align: justify;
}


/*photobanner*/

.photobanner {
  height: 75px;
  width: 3550px;
  margin-bottom: 80px;
}

.photobanner img {
  -webkit-transition: all 0.5s ease;
  -moz-transition: all 0.5s ease;
  -o-transition: all 0.5s ease;
  -ms-transition: all 0.5s ease;
  transition: all 0.5s ease;
}

.photobanner img:hover {
  -webkit-transform: scale(1.1);
  -moz-transform: scale(1.1);
  -o-transform: scale(1.1);
  -ms-transform: scale(1.1);
  transform: scale(1.1);
  cursor: pointer;
  -webkit-box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.2);
  -moz-box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.2);
  box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.2);
}


/*keyframe animations*/

.first {
  -webkit-animation: bannermove 30s linear infinite;
  -moz-animation: bannermove 30s linear infinite;
  -ms-animation: bannermove 30s linear infinite;
  animation: bannermove 30s linear infinite;
}

@keyframes "bannermove" {
  0% {
    margin-left: 0px;
  }
  100% {
    margin-left: -2125px;
  }
}

@-moz-keyframes bannermove {
  0% {
    margin-left: 0px;
  }
  100% {
    margin-left: -2125px;
  }
}

@-webkit-keyframes "bannermove" {
  0% {
    margin-left: 0px;
  }
  100% {
    margin-left: -2125px;
  }
}

@-ms-keyframes "bannermove" {
  0% {
    margin-left: 0px;
  }
  100% {
    margin-left: -2125px;
  }
}

@-o-keyframes "bannermove" {
  0% {
    margin-left: 0px;
  }
  100% {
    margin-left: -2125px;
  }
}
<?xml version="1.0" encoding="UTF-8"?>
<?pcf-stylesheet path="/_resources/xsl/usu.xsl" site="1_XSL" extension="php"?>
  <!DOCTYPE document SYSTEM "http://commons.omniupdate.com/dtd/standard.dtd">			
			<!-- Testing out the scroller -->
	
		<head>
			<meta charset="utf-8"/>
			<meta name="description" content="description">
				<title>Coperate Aggie Sponsers</title>
				<link rel="stylesheet" type="text/css" media="screen" href="style.css"/>
			</meta>
		</head>			
		<body>
			<div id="container">
			<header>
				<h1>Coperate Aggie Sponsers</h1>
				</header>
			<div class="photobanner">
					<a href="https://www.l3t.com/"><img class="first" src="{{f:21250202}}" width="125"                     height="75"/></a>
          <a href="http://www8.hp.com/us/en/home.html"><img src="{{f:21250199}}" width="75"                       height="75"/></a>
          <a href="https://www.conservice.com/"><img src="{{f:21250197}}" width="266" height="75"/></a>
          <a href="http://ramcompany.com/wordpress/"><img src="{{f:21250201}}" width="150"                       height="75"/></a>
          <a href="http://www.imflash.com/"><img src="{{f:21250195}}" width="236" height="75"/></a>
          <a href="http://www.tecuity.com/"><img src="{{f:21250200}}" width="186" height="75"/></a>
          <a href="https://www.vivint.com/"><img src="{{f:21250196}}" width="256" height="75"/></a>
          <a href="https://state.nationalguard.com/utah"><img src="{{f:21250198}}" width="92"                     height="75"/></a>
          <a href="https://www.l3t.com/"><img src="{{f:21250202}}" width="125"                     height="75"/></a>
          <a href="http://www8.hp.com/us/en/home.html"><img src="{{f:21250199}}" width="75"                       height="75"/></a>
          <a href="https://www.conservice.com/"><img src="{{f:21250197}}" width="266" height="75"/></a>
          <a href="http://ramcompany.com/wordpress/"><img src="{{f:21250201}}" width="150"                       height="75"/></a>
          <a href="http://www.imflash.com/"><img src="{{f:21250195}}" width="236" height="75"/></a>
          <a href="http://www.tecuity.com/"><img src="{{f:21250200}}" width="186" height="75"/></a>
          <a href="https://www.vivint.com/"><img src="{{f:21250196}}" width="256" height="75"/></a>
          <a href="https://state.nationalguard.com/utah"><img src="{{f:21250198}}" width="92"                     height="75"/></a>
			</div>
		</div>	
		</body>
			<!-- /com.omniupdate.div -->

图片本身不会在这里显示,因为它是网页本身的内部引用,但概念在那里。

最佳答案

根据您的引用资料,您似乎实现了错误的动画。您需要将以下内容添加到您的 .photobanner CSS:

animation-play-state: running;
animation: bannermove 30s linear infinite;

这是您提供的相同引用的代码笔示例,但处于工作状态:https://codepen.io/anon/pen/mPXgbW

关于html - 试图制作一个包含多个图像的永无止境的图像滚动器,但我被卡住了,有什么提示吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50222722/

相关文章:

python - BS4 : removing <a> tags

javascript - 使用 jQuery 隐藏和显示内容

html - 如何在一个div中垂直对齐一个div?

c++ - 无法在 OpenCV 中打开 1 位二进制图像?

html - 如何通过中央对齐绘制 2 张图像?

javascript - 单击时显示绑定(bind)在输入框下方的复选框

javascript - 以我自己的格式创建随机数据

css - 在 DIV 中居中文本

swift - 来自 Firebase 的图像未显示在 TableView 单元格中 [Swift]

html - 超链接输入图像