添加轮播图的方法
- <div id="banner">
- <div class="swiper-container" id="bannerSwiper_ad1">
- <div class="swiper-wrapper">
- <div class="swiper-slide"><a href="图片链接1" target="_blank"><img class="img" src="图片地址1"/></a></div>
- <div class="swiper-slide"><a href="图片链接2" target="_blank"><img class="img" src="图片地址2"/></a></div>
- <div class="swiper-slide"><a href="图片链接3" target="_blank"><img class="img" src="图片地址3"/></a></div>
- <div class="swiper-slide"><a href="" target="_blank"></a><a href="https://s.click.taobao.com/NQivxgw" target="_blank"><img src="https://img.alicdn.com/tfs/TB1A3dOQpXXXXboXXXXXXXXXXXX-440-180.jpg" width="440" height="180" alt="" /></a></div><div class="swiper-slide"><a href="" target="_blank"></a><a href="https://s.click.taobao.com/Ya5vxgw" target="_blank"><img src="http://gtms01.alicdn.com/tps/i1/TB1bB7dLFXXXXa4XVXXluMv0pXX-440-180.jpeg" width="440" height="180" alt="" /></a></div>
- <div class="swiper-slide"><a href="https://s.click.taobao.com/wh1kxgw" target="_blank"><img class="img" src="https://img.alicdn.com/tfs/TB1p4c4QXXXXXb6aFXXXXXXXXXX-440-180.png"/></a></div><div class="swiper-slide"><a href="https://s.click.taobao.com/hCljxgw" target="_blank"><img class="img" src="https://img.alicdn.com/tps/TB1B2GdQXXXXXXPXFXXXXXXXXXX-440-180.jpg"/></a></div>
- <div class="swiper-slide"><a href="https://s.click.taobao.com/tRKjxgw" target="_blank"><img class="img" src="https://img.alicdn.com/imgextra/i3/2408881097/TB2U8IkjhlmpuFjSZPfXXc9iXXa_!!2408881097.jpg"/></a></div>
- <div class="swiper-slide"><a href="https://s.click.taobao.com/jsyixgw" target="_blank"><img class="img" src="https://img.alicdn.com/tfs/TB1zumJQFXXXXXKXpXXXXXXXXXX-440-180.png"/></a></div>
- <div class="swiper-slide"><a href="https://s.click.taobao.com/xKjixgw" target="_blank"><img class="img" src="https://img.alicdn.com/imgextra/i3/366168414/TB2fKFUjrJkpuFjy1zcXXa5FFXa-366168414.png"/></a></div>
- <div class="swiper-slide"><a href="https://s.click.taobao.com/whVixgw" target="_blank"><img class="img" src="https://img.alicdn.com/tfs/TB1DX.IQXXXXXcaaFXXXXXXXXXX-440-180.jpg"/></a></div>
- <div class="swiper-slide"><a href="https://s.click.taobao.com/x0Mixgw" target="_blank"><img class="img" src="https://img.alicdn.com/tfs/TB1LqdnQpXXXXXtXpXXXXXXXXXX-440-180.jpg"/></a></div>
- <div class="swiper-slide"><a href="https://s.click.taobao.com/Noshxgw" target="_blank"><img class="img" src="https://img.alicdn.com/tfs/TB1SmeaQpXXXXc1aXXXXXXXXXXX-440-180.jpg"/></a></div>
- <div class="swiper-slide"><a href="https://s.click.taobao.com/F5bhxgw" target="_blank"><img class="img" src="https://img.alicdn.com/tfs/TB1JQGXRXXXXXcWXXXXXXXXXXXX-440-180.jpg"/></a></div>
- <div class="swiper-slide"><a href="https://s.click.taobao.com/vUGhxgw" target="_blank"><img class="img" src="https://img.alicdn.com/tfs/TB1sE1lQpXXXXabXpXXXXXXXXXX-440-180.jpg"/></a></div>
- </div>
- </div>
- <div id="bannerpagination_ad1" class="pagination"></div>
- </div>
- <script>
- var mySwiper = new Swiper('#bannerSwiper_ad1',{
- loop: true,
- autoplay:6000,
- speed:1000,
- pagination: '#bannerpagination_ad1',
- paginationClickable: true,
- autoplayDisableOnInteraction:false,
- grabCursor : true,
- parallax:true,
- });
- </script>
复制代码 提示:以上绿色代码是已搞好的带链接的图片,天猫活动广告,图片还是很美观的,如果一时找不到广告,可以用这个,效果如下图轮播:
注意:一个轮播就是以上代码,如果你想再添加一个轮播就再添加一次以上代码,添加时红色代码序号要修改的,不要重复,如果是一个轮播内的图片,宽高比例一定要一致,这样就美观。
为了让手机版首页美观实用,插件加了一个自定义广告内容设置,可以自由编辑,为了方便,提供了一些模板:
简单的图片广告
<table width="100%">
<tr><td><a href="广告链接"><img src="广告图片" width="100%"></a></td><td>...</td><td>...</td></tr>
<tr>...</tr>
</table>
广告内容代码写在<td>与</td>中间,<tr>...</tr>算一行,<td>...</td>算一列,如果想强制宽度,比如一行显示2个同样宽度的图片广告可以这样:
<table width="100%">
<tr><td width="50%"><a href="广告链接"><img src="广告图片" width="100%"></a></td><td width="50%"><a href="广告链接"><img src="广告图片" width="100%"></a></td></tr>
</table>
一、仿美团手机版首页广告
模板代码:
- <style>
- #daogou{padding-top:6px; padding-bottom:5px}#daogou table{width:100%;}#daogou tr td{text-align:center;}#daogou .react{-webkit-box-flex:1;padding:0;border-left:1px solid #ddd;text-align:center}#daogou .imgbox{height:1.2rem;margin:auto;display:block}#daogou .react:first-child{margin-left:0;padding-left:0;border-left:0}#daogou .left{-webkit-box-flex:1}#daogou .info{vertical-align:top;text-align:left;display:inline-block}#daogou .info strong{display:block;color:#55a40f;font-size:13px;margin-top:6px;margin-bottom:10px}#daogou .huilife strong{color:#ff3f0d}#daogou .scense strong{color:#f742a0}#daogou small{display:block;font-size:11px;}
- </style>
- <div id="daogou">
- <table>
- <tbody>
- <tr>
- <td>
- <a class="react" href="http://www.cnit618.com/mall_wap-product-14.html" rel="nofollow"> <span class="info"> <strong>我们约吧</strong> <small>恋人家人好朋友</small> </span> <img class="imgbox" src="http://p0.meituan.net/mmc/fe4d2e89827aa829e12e2557ded363a112289.png" /> </a>
- </td>
- <td style="border-left:#f1f1f1 1px solid;">
- <a class="react huilife" href="http://www.cnit618.com/mall_wap-product-11.html" rel="nofollow"> <span class="info"> <strong>低价超值</strong> <small>十元优惠好生活</small> </span> <img class="imgbox" src="http://p0.meituan.net/mmc/a06d0c5c0a972e784345b2d648b034ec9710.jpg" /> </a>
- </td>
- <td style="border-left:#f1f1f1 1px solid;">
- <a class="react scense" href="http://www.cnit618.com/mall_wap-product-1.html" rel="nofollow"> <span class="info"> <strong>聚餐宴请</strong> <small>朋友家人常聚聚</small> </span> <img class="imgbox" src="http://p1.meituan.net/mmc/08615b8ae15d03c44cc5eb9bda381cb212714.png" /> </a>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
复制代码 推荐在代码模式下修改内容,如果代码修改坏了,可以直接复制以上示例代码,再修改,这样方便些!
修改图片小技巧:可以在正常模式,直接选中图片,点上传图片图标,就可以直接替换图片了,如图:
|