2013-02-16 78 views
1

我想设置这样一个ListView:图像大小的ListView jquerymobile

http://jquerymobile.com/demos/1.2.0/docs/lists/lists-thumbnails.html

我dinamicly生成我的代码

$('#calendarPage').live('pagebeforeshow', function(event) { 
    $('#calendarPage').live('pageshow', function(event) { 
     application.prev = 'menu.html'; 
     //get the actu 
     application.readFile('calendar.json',function(data){ 
      data = JSON.parse(data); 

      var listview = '<ul data-role="listview" class="ui-listview" id="calendarList" >'; 
      for(elem in data){ 
       var date = new Date(data[elem].date); 
       var day = date.getDate(); 
       var month = date.getMonth() + 1; 
       var year = date.getYear(); 
       var hours = date.getHours(); 
       var min = date.getMinutes(); 
       var s = date.getSeconds(); 
       listview += '<li>'; 
       listview += '<img src="'+application.api+data[elem].img+'" /><a href="actuOne.html?id='+elem+'" ><h3>'+data[elem].title+'</h3><p>'+day+'/'+month+'/'+year+' '+hours+':'+min+':'+s+'</p></a>'; 
       listview += '</li>'; 
      } 
      listview += '</ul>'; 
      $('#calendarPage .content').html(listview); 
      $('#calendarList').listview(); 
     }); 
    }); 
}); 
创建

YHE列表视图,但图像没有调整

我尝试添加class =“ui-li-thumb”,但效果不佳

感谢

+0

你能后呈现的代码? – Omar 2013-02-16 23:41:46

回答

1

有你的榜样错误,IMG标签必须为一个标签内,只有那么它会被调整。

看看这个例子:http://jsfiddle.net/Gajotres/w5bcS/

 <ul data-role="listview"> 
      <li><a href="index.html"> 
       <img src="http://www.warrenphotographic.co.uk/photography/bigs/05852-Retriever-puppy-yawning-white-background.jpg" title="sample"/> 
       <h3>Sample image</h3> 
       <p>Sample</p> 
      </a></li> 
      <li><a href="index.html"> 
       <img src="http://www.warrenphotographic.co.uk/photography/bigs/05852-Retriever-puppy-yawning-white-background.jpg" title="sample"/> 
       <h3>Sample image</h3> 
       <p>Sample 2</p> 
      </a></li> 
     </ul> 
+1

感谢它现在的作品 – Ajouve 2013-02-17 09:11:13