<script>
mui.init({
swipeBack: true
});
(function($) {
$('#scroll').scroll({
indicators: false //是否显示滚动条
});
这里var html2 = '<ul class="mui-table-view"><li class="mui-table-view-cell mui-media"><a href="#"><img class="mui-media-object mui-pull-left" src="img/pic2.png"><div class="mui-media-body"><h4>九里飘香</h4><></div></a></li></ul>';
这里var html3 = '<ul class="mui-table-view"><li class="mui-table-view-cell">第三个选项卡子项-1</li><li class="mui-table-view-cell">第三个选项卡子项-2</li><li class="mui-table-view-cell">第三个选项卡子项-3</li><li class="mui-table-view-cell">第三个选项卡子项-4</li><li class="mui-table-view-cell">第三个选项卡子项-5</li></ul>';
var item2 = document.getElementById('item2mobile');
var item3 = document.getElementById('item3mobile');
document.getElementById('slider').addEventListener('slide', function(e) {
if (e.detail.slideNumber === 1) {
if (item2.querySelector('.mui-loading')) {
setTimeout(function() {
item2.innerHTML = html2;
}, 1000);
}
} else if (e.detail.slideNumber === 2) {
if (item3.querySelector('.mui-loading')) {
setTimeout(function() {
item3.innerHTML = html3;
}, 1000);
}
}
});
var sliderSegmentedControl = document.getElementById('sliderSegmentedControl');
$('.mui-input-group').on('change', 'input', function() {
if (this.checked) {
sliderSegmentedControl.className = 'mui-slider-indicator mui-segmented-control mui-segmented-control-inverted mui-segmented-' + this.value;
//force repaint
sliderProgressBar.setAttribute('style', sliderProgressBar.getAttribute('style'));
}
});
})(mui);
</script>
5 个回复
AaronC (作者)
@fxy
DCloud_UNI_CHB
类似如下代码即可,选项卡3的子内容就是:
AaronC (作者)
不行的啊,我选项卡内容有滚动的,复制进去就空白了
2014-11-29 11:57
Yooye
<script>
mui.init({
swipeBack: true
});
(function($) {
$('#scroll').scroll({
indicators: false //是否显示滚动条
});
这里var html2 = '<ul class="mui-table-view"><li class="mui-table-view-cell mui-media"><a href="#"><img class="mui-media-object mui-pull-left" src="img/pic2.png"><div class="mui-media-body"><h4>九里飘香</h4><></div></a></li></ul>';
这里var html3 = '<ul class="mui-table-view"><li class="mui-table-view-cell">第三个选项卡子项-1</li><li class="mui-table-view-cell">第三个选项卡子项-2</li><li class="mui-table-view-cell">第三个选项卡子项-3</li><li class="mui-table-view-cell">第三个选项卡子项-4</li><li class="mui-table-view-cell">第三个选项卡子项-5</li></ul>';
var item2 = document.getElementById('item2mobile');
var item3 = document.getElementById('item3mobile');
document.getElementById('slider').addEventListener('slide', function(e) {
if (e.detail.slideNumber === 1) {
if (item2.querySelector('.mui-loading')) {
setTimeout(function() {
item2.innerHTML = html2;
}, 1000);
}
} else if (e.detail.slideNumber === 2) {
if (item3.querySelector('.mui-loading')) {
setTimeout(function() {
item3.innerHTML = html3;
}, 1000);
}
}
});
var sliderSegmentedControl = document.getElementById('sliderSegmentedControl');
$('.mui-input-group').on('change', 'input', function() {
if (this.checked) {
sliderSegmentedControl.className = 'mui-slider-indicator mui-segmented-control mui-segmented-control-inverted mui-segmented-' + this.value;
//force repaint
sliderProgressBar.setAttribute('style', sliderProgressBar.getAttribute('style'));
}
});
})(mui);
</script>
Yooye
我有类似问题,代码里两个粗体"这里"后面的var html代码只能写在一行里面,不能添加太多html代码
Yooye
如何使后面几个加载跟图片中相同的内容