jquery サイクルを使用して、ページ上のいくつかの画像を回転させようとしています。画像の幅は 1400 ピクセルです。これは、画面解像度が小さい人にとっては、画像の右側が消えてしまうことを意味します。
画像が画像の両側で同じ量を失うようにして、画像の中心を表示ウィンドウの中心に保つようにしたいと思います。
http://renegadeox.com/を見て、ブラウザ ウィンドウのサイズを変更すると、私の言いたいことがわかるでしょう。
javascript を使用して画像をコンテナに対して左に移動し、画像を中央に保つにはどうすればよいですか?
完全を期すためのコードは次のとおりです。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script type="text/javascript" src="http://malsup.github.com/jquery.cycle.all.js"></script>
</head>
<body>
<script type="text/javascript">
$(document).ready(function() {
$('.slideshowWrap').cycle({
fx: 'fade', // http://malsup.com/jquery/cycle/ Background rotater
});
});
</script>
<div style="margin: 0 auto" class="slideshowWrap">
<div class="homeslideshow">
<img src="background_01.jpg" alt="" />
</div>
<div class="homeslideshow">
<img src="background_02.jpg" alt="" />
</div>
<div class="homeslideshow">
<img src="background_03.jpg" alt="" />
</div>
</div>
</body>
</html>