移动选项卡

<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<style>
	select{
		width: 150px;
		height: 200px;
		float: left;
	}
	div{
		width: 100px;
		height: 200px;
		float: left;
	}
</style>
<body>
	<select name="" id="cid" multiple>
		<option value="0">林志玲</option>
		<option value="1">杨幂</option>
		<option value="2">闫妮</option>
		<option value="3">佟丽娅</option>
		<option value="4">毛晓彤</option>
		<option value="5">凤姐</option>
		<option value="6">宋雨琦</option>
	</select>
	<div>
		<button onclick="func('cid','mid')"> >>>>> </button>
		<button onclick="func('mid','cid')"> <<<<< </button>
	</div>
	
	<select name="" id="mid" multiple="">
		
	</select>
</body>
<script>
	function func(id,id1)
	{
		//获取对象 当你点击 >>> 对象是cid  <<< mid
		// 当你点击    <<<   对象是mid    >>>cid
		obj = document.getElementById(id);
		obj1 = document.getElementById(id1);
		// console.log(obj);
		//获取option标签
		op = obj.options;
		for(i=0;i<op.length;i++)
		{
			if(op[i].selected)
			{	
				//取消默认选中内容
				op[i].selected = false;
				//移动标签到另一标签
				obj1.add(op[i]);
				i--;
			}
		}
	}
</script>
</html>

在这里插入图片描述

[removed] $(function() { function setCurrentSlide(ele, index) { $(".swiper1 .swiper-slide").removeClass("selected"); ele.addClass("selected"); //swiper1.initialSlide=index; } var swiper1 = new Swiper('.swiper1', { // 设置slider容器能够同时显示的slides数量(carousel模式)。 // 可以设置为number或者 'auto'则自动根据slides的宽度来设定数量。 // loop模式下如果设置为'auto'还需要设置另外一个参数loopedSlides。 slidesPerView: 5.5, paginationClickable: true,//此参数设置为true时,点击分页器的指示点分页器会控制Swiper切换。 spaceBetween: 10,//slide之间的距离(单位px)。 freeMode: true,//默认为false,普通模式:slide滑动时只滑动一格,并自动贴合wrapper,设置为true则变为free模式,slide会根据惯性滑动且不会贴合。 loop: false,//是否可循环 onTab: function(swiper) { var n = swiper1.clickedIndex; } }); swiper1.slides.each(function(index, val) { var ele = $(this); ele.on("click", function() { setCurrentSlide(ele, index); swiper2.slideTo(index, 500, false); //mySwiper.initialSlide=index; }); }); var swiper2 = new Swiper('.swiper2', { //freeModeSticky 设置为true 滑动会自动贴合 direction: 'horizontal',//Slides的滑动方向,可设置水平(horizontal)或垂直(vertical)。 loop: false, // effect : 'fade',//淡入 //effect : 'cube',//方块 //effect : 'coverflow',//3D流 // effect : 'flip',//3D翻转 autoHeight: true,//自动高度。设置为true时,wrapper和container会随着当前slide的高度而发生变化。 onSlideChangeEnd: function(swiper) { //回调函数,swiper从一个slide过渡到另一个slide结束时执行。 var n = swiper.activeIndex; setCurrentSlide($(".swiper1 .swiper-slide").eq(n), n); swiper1.slideTo(n, 500, false); } }); }); [removed]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值