添加此代码后,应用程序将显示在空白区域
下方for (var i=0; i<len; i++)
{
kk=i+1;
audio[i] = false;
$('body').append('<div data-role="page" id="a'+i+'" data-theme="b" data-add-back-btn="true">
<div data-role="header" ><h1>'+results.rows.item(i).name+'</h1></div></div>');
$('#a'+i).append('<div data-role="content" >
<img src="images/small/'+results.rows.item(i).img+'" class = "center" id="img"/>
<p>Время - '+results.rows.item(i).time+'</p>
<p>Телефон - '+results.rows.item(i).phone+'</p>
<p>Рабочее время - '+results.rows.item(i).workTime+'</p>');
$('#a'+i).append('<p id="description">'+results.rows.item(i).shortDescription+'</p>
<audio ontimeupdate="if (this.duration == this.currentTime) {this.currentTime = 0; this.pause()}; var activePage = $(\'.ui-page-active\').attr(\'id\');
if (activePage != \'a'+i+'\') {document.getElementById(\'audio'+i+'\').pause();} " id = "audio'+i+'" src="file:///sdcard/Download/Tur/'+results.rows.item(i).link+'"></audio>');
$('#a'+i).append('<div id = "virtbutton" onclick="window.plugins.fileOpener.open(\'file:///sdcard/Download/Tur/'+results.rows.item(i).flash+'\');
document.getElementById(\'audio'+i+'\').play() "style = " background-image: url(\'images/virt.png\');background-repeat: no-repeat;width: 333px; height: 128px; position: absolute; margin-top:22px; display: block; float: left; " ></div>');
$('#a'+i).append('<div style = " background-image: url(\'images/song.png\');background-repeat: no-repeat;width: 128px; height: 128px; position: absolute; margin: 18px 0 0 212px; display: block; float: left;"
onclick = "if (!audio'+[i]+') {document.getElementById(\'audio'+i+'\').play(); audio'+[i]+'= true;} else {document.getElementById(\'audio'+i+'\').pause(); audio'+[i]+'= false;}"></div>');
$('#a'+i).append('<div style = "clear: both"></div><button onclick = "alert("lol"); db.transaction(function(tx) {tx.executeSql(\'INSERT INTO Routes (id_object) values('+i+')\')});">Добавить в БД</button></div>');
在每个窗口中,都有不同的空间。如何摆脱它?
答案 0 :(得分:0)
您可以通过为两个div添加“Float: left
”到[style]
属性来删除此空白区域。