水平附加图像
Append images horizontally
我试图在一行中显示servlet(图像)的输出,但图像是垂直附加的。
这是我的jsp代码:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<link rel="Stylesheet" type="text/css" href="css/smoothTouchScroll.css" />
<link rel="stylesheet" href="dist/jquery.rondell.css" type="text/css" media="all" title="Screen">
<script type="text/javascript" src="libs/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="libs/modernizr-2.0.6.min.js"> </script>
<script type="text/javascript" src="dist/jquery.rondell.js"></script>
<link rel="Stylesheet" type="text/css" href="css/smoothTouchScroll.css" />
<link rel="Stylesheet" type="text/css" href="css/style1.css" />
<style type="text/css">
#TouchScroller
{
position:relative;
width:auto;
height:auto;
}
#TouchScroller div.scrollableArea img
{
position: relative;
float: left;
padding: 0;
margin: 0;
width:100%;
height:50%;
}
</style>
<script src="js/jquery-ui-1.10.3.custom.min.js"></script>
<script src="js/jquery.kinetic.min.js"></script>
<script src="js/jquery.smoothTouchScroll.min.js"></script>
</head>
<body>
<div>
<sql:setDataSource var="webappDataSource"
driver="com.mysql.jdbc.Driver" url="jdbc:mysql://pshrivas-eni.cwgbkmxxzso1.ap-southeast-1.rds.amazonaws.com:3306/eni_support"
user="db_user" password="password123" />
<sql:query dataSource="${webappDataSource}"
sql="select imgid,count1 from carousel_three" var="result1" />
<div id="car1" class="carousel">
<div id="rondellCarousel" class="hidden">
<c:forEach var="row" items="${result1.rows}">
<img id="img" src="${pageContext.servletContext.contextPath }/Imagedb?id=${row.imgid}" />
</c:forEach>
</div>
</div>
</div>
<script type="text/javascript">
$(function() {
// Create a rondell with the 'carousel' preset and set an option
// to disable the rondell while the lightbox is displayed
$("#rondellCarousel").rondell({
preset: "carousel",
onAfterShift:function(idx){
// alert(idx);
itemLoadCallback: trigger(idx)
}
});
});
function trigger(idx, state)
{
//document.getElementById('TouchScroller').innerHTML=" ";
$.ajax({
type : "GET",
url : "Sampleimage1",
contentType :"application/json",
data:{id:idx},
success : function(data) {
$.each(data,function(index,item){
$.each(item,function(i,obj){
var img = $('<img id="dynamic">'); //Equivalent: $(document.createElement('img'))
img.attr('src','data:image/jpg;base64,' +obj.map.key );
img.appendTo('.scrollableArea');
// $('.scrollableArea').append('<img src="data:image/jpg;base64,' +obj.map.key+'" />');
});
});
}
});
}
</script>
<div id ="car2" class="carousel1">
<div id="TouchScroller">
</div>
</div>
<script>
$("#TouchScroller").smoothTouchScroll({
continuousScrolling: true
});
</script>
</body>
</html>
这是我当前得到的预览,但我想在一行中显示所有图像。请帮我处理这个
我相信#TouchScroller div.scrollableArea img
上的width:100%;
会迫使图像尽可能多地占据容器,我会删除它并研究:
- display:inline块这将允许您的元素并排显示
- 空白:nowrap这将阻止你的元素向下换行到下一行(如果这是你想要的)
请务必检查容器的宽度(.TouchScroller
),以确保它是页面的全宽。这通常通过width:100%;
完成
相关文章:
- JS-在一段时间后水平移动图像
- 单击水平滚动库中的图像以居中显示无法工作的功能
- 具有无限水平滚动的流体可调整大小图像(修订版 2)
- JQuery mobile:使用网格将多个图像垂直和水平居中
- 图像(绝对定位)相对定位容器中的水平中心
- CSS3-如何交叉显示未知高度的图像,并将其垂直和水平居中
- jquery中的无限水平图像库
- AngularJS-将图像的水平滚动条居中
- 水平附加图像
- 固定背景图像水平连接到具有固定宽度的内容
- 在横幅中水平对齐图像和 JavaScript 旋转图像
- 水平居中高度变化的图像,而不会扭曲图像
- 我希望能够水平滚动大图像,但同时显示可以可变的整个高度
- 没有水平滚动条的 Jquery 图像动画
- 水平移动背景图像
- 滑块水平缩略图导航器大小和图像数量
- 使用查询的水平图像滚动
- 使用预制的javascript放大镜时,如何水平排列图像并使用css居中
- 如何只翻转图像水平而不是画布
- 使用 jquery 将图像水平移动到左侧