mui轮播绑定

<div class="mui-content">
                    <ul class="mui-table-view mui-table-view-chevron">
                        <li id="switch" class="mui-table-view-cell" style="display: none;">
                        </li>
                    </ul>
                </div>

                <div id="topdata"></div>
function GetArticleList() {
        var json = {};
        json.action = "GetArticleList";
        json.count = 3;
        json.classid = 1;
        $.post(articlemsgapi, json, function (msg) {

            if (msg != "0") {

                var obj = eval("(" + msg + ")");
                var dataRow = obj.rows;
                var count = parseInt(dataRow.length);
                if (count > 0) {


                    var html = '<div id="slider" class="mui-slider">';

                    html += '<div class="mui-slider-group mui-slider-loop">'
                    html += '<div class="mui-slider-item mui-slider-item-duplicate">';
                    if (dataRow[dataRow.length - 1].JSON_linkurl == "#") {
                        html += '    <a href="#">';
                    } else {
                        html += '    <a href="' + dataRow[dataRow.length - 1].JSON_linkurl + '">';
                    }
                    html += '        <img src="' + dataRow[dataRow.length - 1].JSON_defaultpicurl + '">';
                    html += '    </a>';
                    html += '</div>';

                    $.each(dataRow, function (index, item) {

                        html += '<div class="mui-slider-item">';
                        if (item.JSON_linkurl == "#") {
                            html += '    <a href="#">';
                        } else {
                            html += '    <a href="' + item.JSON_linkurl + '">';
                        }
                        html += '        <img src="' + item.JSON_defaultpicurl + '">';
                        html += '    </a>';
                        html += '</div>';

                    });

                    html += '<div class="mui-slider-item mui-slider-item-duplicate">';
                    if (dataRow[0].JSON_linkurl == "#") {
                        html += '    <a href="#">';
                    } else {
                        html += '    <a href="' + dataRow[0].JSON_linkurl + '">';
                    }
                    html += '        <img src="' + dataRow[0].JSON_defaultpicurl + '">';
                    html += '    </a>';
                    html += '</div>';
                    html += ' </div>  ';
                    html += ' </div>  ';

                    $("#topdata").append(html);

                    mui('#slider').slider({
                        interval: 3000
                    });
                }
            }
        });
    }

 

posted @ 2018-08-20 14:27  ▍凉城空巷°  阅读(136)  评论(0编辑  收藏  举报