1

私はそのようなリストビューを設定しようとしています:

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

コードを動的に生成します

$('#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();
        });
    });
});

リストビューは作成されますが、画像のサイズは変更されません

class = "ui-li-thumb"を追加しようとしましたが、うまく機能しません

ありがとう

4

1 に答える 1

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>
于 2013-02-17T08:19:50.230 に答える