Git Product home page Git Product logo

sass-slider's Introduction

sass-slider 轮播图

原生js、sass编写轮播图组件,支持自定义属性 image

特点

原生JS编程,不依赖任何第三方库

组件化

支持自定义属性

使用sass编写样式

使用方法

html:

<head>
		<meta charset="UTF-8">
		<title>轮播</title>
		<link rel="stylesheet" type="text/css" href="./style/slider.css">
	</head>
	<body>
		<div id="banner"></div>
		<script type="text/javascript" src="./scripts/slider.js"></script>
	</body>

script:

    <script type="text/javascript">
			
			//设置你所需要的参数
			var options = {};
			options.oDiv=document.getElementById("banner");
			var imgs = ["./img/bg1.jpg","./img/bg2.jpg","./img/bg3.jpg","./img/bg4.jpg","./img/bg5.jpg","./img/bg6.jpg","./img/bg7.jpg","./img/bg8.jpg"]; //传入所需图片的地址
			options.imgs = imgs;
			options.hrefs=["#","#","#","#","#"]; //点击图片跳转地址
			options.height = "440px";  //轮播图宽高
			options.width = "100%";
			options.ulName = "slider-ul";//轮播图ul的样式类名字
			options.liName = "slider-li";//轮播图li的样式类名字
			options.navName = "nav";//小圆点的样式类名字
			options.navActive = "active";//选中圆点时的样式 对应当前图片的圆点的样式
			options.btnName = "btn";  //前后翻页按钮类名字
			options.time= 3000;//传入轮播时间间隔
			var slider = new Slider(options);
			
		</script>

sass-slider's People

Contributors

tangzhirong avatar

Stargazers

fishcui avatar  avatar  avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.