【问题标题】:2 div elements form an empty white space2个div元素形成一个空白区域
【发布时间】:2013-05-13 21:34:26
【问题描述】:

添加此代码后,应用程序出现在空白区域下方

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>'); 

每个窗口都有不同的空间。如何摆脱它?

【问题讨论】:

  • 你真的不希望有人读到它,是吗?
  • 另外,你真的应该摆脱那些内联样式并使用 CSS。并摆脱 onclick 助手并使用 $('body').on("click", '.someclass', function() { });阅读这个代码块仍然相当不可能。

标签: cordova jquery-mobile


【解决方案1】:

您可以通过将“Float: left”添加到两个 div 的 [style] 属性来删除此空白。

【讨论】:

  • 你能发布完整的 html 视图吗
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-12-21
  • 1970-01-01
  • 2014-05-22
  • 2017-03-16
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多