回复 String:
我把我代码贴一段你帮我看看好不?我加了宽度还是不行,
这是容器的地方
<div id="slider" class="mui-slider mui-fullscreen">
<div id="sliderSegmentedControl" class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted" >
<div id="category" class="mui-scroll" style="min-width: 50px;">
<!--这是选项卡栏目,就是这里无法跟着内容列表滑动-->
</div>
<div style="margin-top: 40px;width: 100%;height: 40px;background-color: #FFF;margin-bottom: 0px;">
<select style="float: left; width: 30%;margin-bottom: 0px;height: 40px;">
<option value="volvo">综合排序</option>
<option value="saab">信用</option>
<option value="opel">价格由高到低</option>
<option value="audi">价格由低到高</option>
</select>
<span style="float: left;width: 40%;line-height: 40px;height: 40px;">销量优先</span>
<!--<span class="mui-icon mui-icon-refreshempty" style="border:1px solid #fff;" onclick="refresh()"></span>-->
</div>
</div>
这是动态添加的代码:
$(function (){
var params = {};
var url = 'http://tbqc.weiyucheye.com/index.php/Home/Cate';
$.post(url, params, function(d){
$("#category").empty();
$.each(d.items_cate,function(i,val){
if(i == 0){
var index = i;
var listid ="item"+ index +"mobile";
var html = '<a class="mui-control-item mui-active" href="#'+listid+'" style="min-width:20px">' + val.name + '</a>';
$("#category").append(html);
mui("slider").slider();
mui(".mui-scroll-wrapper").scroll();
$.each(val.list, function(j,vbl) {
if(vbl.shop_type == "C"){
var shoptype = "淘宝";
}
if(vbl.shop_type == "B"){
var shoptype = "天猫"
}
// 动态加载选项卡导航
var html = '<li class="mui-table-view-cell mui-media mui-col-xs-6"><a href="'+vbl.quanurl+'"><img class="mui-media-object" src="'+vbl.pic_url+'"><div class="mui-media-body">'+vbl.title+'</div><div class="goods_info"> <span class="price_info">¥'+vbl.coupon_price+'</span> <span class="fav_num" style="float: right;">'+shoptype+'</span></div></a></li>';
var copyid = index+"commodity";
$("#"+ copyid+ "").append(html);
});
}else{ //动态添加选项卡容器
var index = i;
var listid ="item"+ index +"mobile";
var html = '<a class="mui-control-item" href="#'+listid+'" style="min-width:20px">' + val.name + '</a>';
$("#category").append(html);
mui("slider").slider();
//添加选项卡容器的对应的内容
var html = '<div id="item'+index+'mobile" class="mui-slider-item mui-control-content"><div class="mui-scroll-wrapper" ><div class="mui-scroll"><ul class="mui-table-view mui-grid-view" id="'+index+'commodity"></ul></div></div></div>'
$("#itembox").append(html);
mui("slider").slider();
mui(".mui-scroll-wrapper").scroll();
$.each(val.list, function(j,vbl) {
if(vbl.shop_type == "C"){
var shoptype = "淘宝";
}
if(vbl.shop_type == "B"){
var shoptype = "天猫"
}
var html = '<li class="mui-table-view-cell mui-media mui-col-xs-6"><a href="'+vbl.quanurl+'"><img class="mui-media-object" src="'+vbl.pic_url+'"><div class="mui-media-body">'+vbl.title+'</div><div class="goods_info"> <span class="price_info">¥'+vbl.coupon_price+'</span> <span class="fav_num" style="float: right;">'+shoptype+'</span></div></a></li>';
var copyid = index+"commodity";
$("#"+ copyid+ "").append(html);
});
}
});
}, 'json');
});
附件是源代码。 谢谢了。这个我真的头疼了。。
问问你 (作者)
对的
2017-06-09 10:59