4.3.轮播图布局和样式

templates/news/index.html

<div class="news-wrapper">
<div class="banner-group">
<ul class="banner-ul">
<li>
<a href="">
<img src="https://static-image.xfz.cn/1523588994_243.jpg" alt="">
</a>
</li>
<li>
<a href="">
<img src="https://static-image.xfz.cn/1521444982_469.jpg" alt="">
</a>
</li>
<li>
<a href="">
<img src="https://static-image.xfz.cn/1521444982_469.jpg" alt="">
</a>
</li>
<li>
<a href="">
<img src="https://static-image.xfz.cn/1523588994_243.jpg" alt="">
</a>
</li>
</ul>
</div>
</div>

src/css/index.scss

        .news-wrapper{
float: left;
width: 798px;
height: 500px;
background: #fff; .banner-group{
width: 100%;
height: 202px;
background: #0a275a; .banner-ul{
overflow: hidden;
width: 798px * 4; li{
float: left;
width: 798px;
height: 202px; img{
width: 798px;
height: 202px;
}
}
}
}
} .sidebar-wrapper{
float: right;
width: 356px;
height: 500px;
background: darkseagreen;
}
}
}

4.4.实现一次轮播

templates/news/index.html

<script src="../../dist/js/jquery-3.3.1.min.js" ></script>
<script src="../../dist/js/index.min.js" ></script> <ul class="banner-ul" id="banner-ul">

src/js/index.js

//初始化
function Banner() { }; //添加一个run方法
Banner.prototype.run = function () {
var bannerUL = $("#banner-ul");
//500是间隔时间0.5s
bannerUL.animate({"left":-798},500)
}; //页面加载完成后执行。创建一个对象,运行方法
$(function () {
var banner = new Banner();
banner.run()
});

4.5.实现自动轮播

src/js/index.js

//添加一个run方法
Banner.prototype.run = function () {
var bannerUL = $("#banner-ul");
var index = 0;
setInterval(function () {
if(index >= 3){
index = 0
}else{
index++;
}
bannerUL.animate({"left":-798*index},500);
},2000); };

Django打造大型企业官网(四)的更多相关文章

  1. 超细讲解Django打造大型企业官网

    本文为知了课堂黄勇老师讲的<超细讲解Django打造大型企业官网>的笔记. 第一章 Django预热 1.创建virtualenv虚拟环境 2.URL组成部分详解 3.Django介绍 4 ...

  2. Django打造大型企业官网

    第1章 Django预热 1-为什么需要虚拟环境 2-virtualenv创建虚拟环境 3-virtualenvwrapper使用 4-URL组成部分讲解 5-课程准备工作 6-Django介绍 第2 ...

  3. Django打造大型企业官网(三)

    四.前端首页 4.1.导航条实现 (1)templates/new/index.html <!DOCTYPE html> <html lang="en"> ...

  4. Django打造大型企业官网(二)

    三.项目环境搭建 3.1.创建项目环境和安装包 创建django项目 mkvirtualenv DjangoProject workon DjangoProject pip install -i ht ...

  5. Django打造大型企业官网(八)

    4.16.侧边栏标题和广告位布局完成 templates/news/index.html <div class="sidebar-wrapper"> <div c ...

  6. Django打造大型企业官网(七)

    4.13.新闻列表tab栏布局完成 templates/news/index.html <div class="list-outer-group"> <ul cl ...

  7. Django打造大型企业官网(六)

    4.9.根据轮播图个数修改小圆点数量 src/js/index.js function Banner() { this.bannerWidth = 798; } Banner.prototype.in ...

  8. Django打造大型企业官网(五)

    4.6.切换轮播图的箭头样式以及显示和隐藏 templates/news/index.html <span class="arrow left-arrow">‹< ...

  9. Django打造大型企业官网(一)

    一.nvm的安装 (1)下载:nvm1.16 (2)安装完成后添加环境变量 C:\Users\Administrator\AppData\Roaming\nvm (3)修改settings.txt,将 ...

随机推荐

  1. cf536c——思路题

    题目 题目:Lunar New Year and Number Division 题目大意:给定一个数字序列,可以任意分组(可调整顺序),但每组至少两个,求每组内数字和的平方的最小值 思路 首先,易证 ...

  2. ztree 样式修改 white-space: nowrap; 后 下划线要是跟上的话 宽度 width 要 auto 就自动更新了

    width:auto; border-bottom:1px solid #ccc; height:30px; display: inline-block;white-space: nowrap;

  3. python练习2 购物车程序

    # -*- coding: utf-8 -*-# @Time : 2018/10/18 16:06# @Author : Two Brother# @EMAIL : yeluyide@163.com# ...

  4. mysql 查看存储过程 并导出

    查询数据库中的存储过程 select * from mysql.proc where db = dbName and `type` = 'PROCEDURE' show procedure statu ...

  5. 扩展IHttpHandler

    前面提到当请求进入到IIS,IIS转发给ISAPI后会根据文件的后缀名来决定将请求转发给对应的处理程序进行处理,当然一大部分的处理都是交给了AspNet_ISAPI 了.但是,AspNet_ISAPI ...

  6. Mybatis输入输出映射_动态sql_关联关系(一对一、一对多、多对多)

    Mybatis输入输出映射_动态sql_关联关系(一对一.一对多.多对多)输入输出映射parameterType完成输入映射parameterType可以传入的参数有,基本数据类型(根据id查询用户的 ...

  7. js使用canvas在前端压缩图片

    HTML代码: <input id="file" type="file"> JS代码: var eleFile = document.querySe ...

  8. npm run build报错(npm ERR! code ELIFECYCLE)的解决办法

    具体报错如下图: 环境:centos7 应该node_modules安装问题,我们需要重新安装 rm -rf node_modules rm package-lock.json npm cache c ...

  9. C#基础学习(一)

    ---恢复内容开始--- 1.最近被安排去做C#开发,然后开始一连串的看文档·看视屏,发现学C#给自己补了很多基础,C#每个函数变量什么都要先声名,而python可以直接定义: 一.数据类型 1.整数 ...

  10. Codeforces Beta Round #19D(Points)线段树

    D. Points time limit per test 2 seconds memory limit per test 256 megabytes input standard input out ...