Commit 03455e1b by hank

首页模拟数据

parent 4384298d
...@@ -469,7 +469,7 @@ ...@@ -469,7 +469,7 @@
<div class="menu-item">数字互动解决方案</div> <div class="menu-item">数字互动解决方案</div>
</div> </div>
</div> </div>
<div class="more text-center">more >></div> <div class="more text-center"> <a href="dynamic.html" style="color: black;">more >></a> </div>
</div> </div>
</div> </div>
...@@ -534,6 +534,8 @@ ...@@ -534,6 +534,8 @@
</body> </body>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
var sliceNum = 6; // 展示数量
var sliceNum2 = 4; // 展示数量
var mySwiper = new Swiper('.swiper-container', { var mySwiper = new Swiper('.swiper-container', {
direction: 'horizontal', // 垂直切换选项 direction: 'horizontal', // 垂直切换选项
loop: true, // 循环模式选项 loop: true, // 循环模式选项
...@@ -552,7 +554,51 @@ ...@@ -552,7 +554,51 @@
// scrollbar: { // scrollbar: {
// el: '.swiper-scrollbar', // el: '.swiper-scrollbar',
// }, // },
}) });
// 生成解方案html
function createSolutionHtml(data) {
data= data.slice(0, sliceNum);
console.log(data)
var html = "";
data.forEach(function (item) {
html +=
'<div class="item">' +
'<a href="./productDetail.html?id='+item.id +'"> '+
' <img src="'+ item.imagesUrl+'" alt=""></a>'+
'<div class="item-title">'+item.proName+'</div>'+
'</div>'
});
return html;
}
function createDynamicHtml(data) {
data= data.slice(0, sliceNum2);
var html = "";
data.forEach(function (item) {
html +=
'<div class="item"> ' +
'<a href="./dynamicDetail.html?id='+ item.id+'"> ' +
'<div class="img-container">' +
'<img src="' +
item.imagesUrl +
'" alt="">' +
'</div>' +
'<div class="item-title item-title2"> ' +
item.title +
'</div>' +
'<div class="bottom-word">' +
'<span class="name">'+ item.type +'</span> '+
'<span class="date"><img src="../img/time.png" alt="">'+ item.date +'</span> '+
' </div>' +
'</a></div>';
});
return html;
}
$('#dashuju').html(createSolutionHtml(ideal.produtsList));
$('.industry-dynamics .list-item').eq(0).html(createDynamicHtml(ideal.dynamicList))
// 生成活动html
// 菜单切换
function tab(container) { function tab(container) {
$('.menu-item').click(function(e) { $('.menu-item').click(function(e) {
$(this).parent().children().removeClass('active'); $(this).parent().children().removeClass('active');
...@@ -564,6 +610,7 @@ ...@@ -564,6 +610,7 @@
list_item.eq(index).show(); list_item.eq(index).show();
}) })
} }
tab() tab()
}); });
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment