gpt4 book ai didi

javascript - 水平附加图像

转载 作者:行者123 更新时间:2023-11-28 06:09:06 24 4
gpt4 key购买 nike

我试图在单行中显示 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>

This is a preview of what I currently get ,但我想连续显示所有图像。请帮我解决这个问题

最佳答案

我相信 width:100%; 在你的 #TouchScroller div.scrollableArea img 上强制图像占据尽可能多的容器,我会删除它并调查:

请务必检查容器 (.TouchScroller) 的宽度,以确保它是页面的整个宽度。这通常通过 width:100%;

完成

关于javascript - 水平附加图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36275484/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com