导航

萌即是正义!时不时分享一些ACG活动记录与有趣代码的小站!

侧边栏
热门文章
1推文
酒店免费把我的双人床升级成了2张双人床!空间是大了许多,但是1个住有些浪费呀。
热度
544
2推文
飞猪说这一班飞机没有餐食,结果特意吃饱了上飞机,结果突然端出来量大管饱的飞机餐我都懵了。 这是一条来自高空的推文。
热度
428
3页面
程序员老黄历&求签
热度
312
4推文
抵达台北开始6天5夜的台湾之旅!
热度
219
5博文
《孤独摇滚》圣地巡礼——金泽八景
热度
117
6博文
《孤独摇滚》圣地巡礼——下北泽&下北泽咖喱节2023
热度
104
7推文
《苍之彼方的四重奏 10th Anniversary Box》预计2025年3月28日发售,售价为含税19800日元(约922人民币)。 其中如果购买了sprite LIMITED EDITION或FILMIC EDITION版的话,还有机会将名字(猜测)登在结尾字幕中! sprite LIMITED EDITION版售价39800日元(约1853人民币),FILMIC EDITION版售价149800日元(约6973人民币)。 感觉如果花1853人民币就能把"维基萌"打在游戏结尾字幕中也似乎不错的样子?🤔 《苍之彼方的四重奏 10th Anniversary Box》专题页面:https://sprite.net/aokana/10thanniversary/box
热度
91
8博文
探访《蜡笔小新》老家——春日部游记
热度
78
9推文
最新一集的《mono女孩》里的《摇曳露营△》彩蛋真的太多啦!
热度
65
10推文
今天去看了首部初音未来的电影《剧场版 世界计划 破碎的世界与无法歌唱的未来》。 说是初音未来的电影,但其实是手游《世界计划》的剧场版。好像有挺多人看到是初音未来的电影就去看了,结果发现并不全是😅。其实在宣传海报中,初音未来后面的那些人才是主角。 不过,我也是那些没玩过手游的观众之一。其实整场看下来问题也不是很大,就是对于人物关系和世界观的设定可能会有些问题。电影其实也很贴心地在剧情开头,大致以剧情的形式展示了手游中的五个团体的人物及其性格,但感觉还是有些杯水车薪,约等于看个眼熟。 此次的电影是第一次购买应援场。所谓的应援场,就是能在电影院里像是听演唱会一样挥舞荧光棒和尽情呐喊。看着前排那些粉丝看到自己喜欢角色时的呐喊,以及演唱会环节的打CALL,应援场确实是很有意思的一种电影观看方式呢! 剧情方面,属于看了开头大概能猜到整部动画的剧情走向。不过,通过演唱会的气氛渲染,甚至还感受到了一丝丝的感动。 总体来说,对于手游的粉丝来说可能是嘉年华般的狂喜,对于没接触过手游的路人来说也能一定程度融入其中,属于一部不错的粉丝向电影(不管是手游粉丝还是初音未来粉丝)。 首周电影特典是CD和游戏内的兑换码。送CD这种形式还第一次遇到,官方大气!
热度
65
最新评论
广树管理员
2025-04-29 22:48
@夕阳西下:哈哈哈,是这么操作的
夕阳西下
2025-04-29 22:46
一个睡觉,另外一个放衣服
广树管理员
2025-04-29 21:37
@Zrzzz:期待第四季的摇曳露营吧
广树管理员
2025-04-29 21:37
@mikusa:哈哈哈,确实有点出戏
广树管理员
2025-04-29 21:37
@ZeroCounter:是吗?真的被飞机的量吓到了。2块面包,1盒咖喱米饭,1碗沙拉,1碗水果,1杯茶,1杯水。
攻略中
星空列车与白的旅行
暂无评分
Steam星空列车与白的旅行
2025年2月22日 22时 ~ 攻略中
已累计游玩2个月6天
乘坐的列车,划破夜空,飞驰在星空之下,令人心旷神怡——这可真是场超值之旅。舒爽夜风吹拂下的随心独旅中,我邂逅了随性的乘客,可人怜爱的乘务员。以及……猫耳少女?这场旅行,究竟会在她身上,留下了些什么呢?
PSN奖杯卡

PSN奖杯卡

归档
赞助商广告

【jQuery】宝贝晒图

作者:广树时间:2016-03-02 19:56:23分类:JavaScript

自己写了个类似淘宝晒图的代码,但是感觉还有些凌乱,应该还能优化。

CSS部分:

<style>
.content-img-list img {
	height: 30px;
	width: 45px;
	vertical-align: middle;
}
.content-img-box .content-img-list {
	float: left;
	margin-right: 10px;
	border: 2px solid #fff;
 *zoom:1;
	position: relative;
	transition: border-color .2s ease-out;
	cursor: pointer;
}
.member-discuss .content-img-box {
	margin-top: 8px;
}
.content-img-box ul .tm-current {
	border: 2px solid #fab900;
	border-radius: 2px;
	-webkit-border-radius: 2px;
	-moz-border-radius: 2px;
	-o-border-radius: 2px;
	cursor: pointer;
}
.tm-current .tm-photos-arrow {
	filter: alpha(opacity=100);
	opacity: 1;
	bottom: -12px
}
.tm-photos-arrow {
	width: 0;
	height: 0;
	line-height: 0;
	font-size: 0;
	border: transparent 6px dashed;
	border-top: 6px solid #fab900;
	position: absolute;
	left: 15px;
	filter: alpha(opacity=0);
	opacity: 0;
	bottom: -8px;
	background: 0 0
}
.content-img-box .img_zoom_box img {
	cursor: pointer;
}
.content-img-box .img_zoom_box {
	position: relative;
	margin: 10px 0;
	border: 1px solid #141414;
	background: #fff;
	padding: 2px;
	overflow: hidden;
	display:none;
	width:0px;
	height:0px;
}
.img_zoom_box .img-goleft {
	width: 30%;
    left: 0;
    cursor: url(http://static.360buyimg.com/item/main/1.0.6/css/i/pic-prev.cur),auto;
    z-index: 3;
	position: absolute;
    height: 100%;
    top: 0;
    background: fixed url(about:blank);
}
.img_zoom_box .img-goleft-ico {
	background-image: url(../images/iconfont-left.png);
	background-repeat: no-repeat;
	background-position: center center;	
}
.img_zoom_box .img-goright {
	width: 30%;
    right: 0;
    cursor: url(http://static.360buyimg.com/item/main/1.0.6/css/i/pic-next.cur),auto;
    z-index: 3;
	position: absolute;
    height: 100%;
    top: 0;
    background: fixed url(about:blank);
}
.img_zoom_box .img-goright-ico {
	background-image: url(../images/iconfont-right.png);
	background-repeat: no-repeat;
	background-position: center center;	
}
.img_zoom_box .img-gomid {
	width: 100%;
    left: 0;
    cursor: url(http://static.360buyimg.com/item/main/1.0.6/css/i/small.cur),auto;
    z-index: 2;
	position: absolute;
    height: 100%;
    top: 0;
    background: fixed url(about:blank);
}
.img-go-box{
	position: absolute;
    height: 100%;
    width: 100%;
}
.img-zoom-viewer{
	position: relative;
}
.img-zoom-viewer img{
	max-width:496px;
}
</style>


HTML部分:

<div class="content-img-box">
	<ul>
		<li class="content-img-list">
			<img src="https://www.wikimoe.com/content/uploadfile/201602/d2da1456548019.jpg" /> <b class="tm-photos-arrow"></b> 
		</li>
		<li class="content-img-list">
			<img src="https://www.wikimoe.com/content/uploadfile/201602/60231455544046.jpg" /> <b class="tm-photos-arrow"></b> 
		</li>
		<li class="content-img-list">
			<img src="https://www.wikimoe.com/content/uploadfile/tpl_options/hd1.jpg" /> <b class="tm-photos-arrow"></b> 
		</li>
	</ul>
	<div style="clear:both;">
	</div>
	<div class="img_zoom_box">
		<div class="img-zoom-viewer">
		</div>
		<div class="img-goleft">
		</div>
		<div class="img-gomid">
		</div>
		<div class="img-goright">
		</div>
	</div>
</div>


JS部分:

<script language="javascript">
$(document).ready(function () {
	$('.content-img-list').click(function() {  
	  if($(this).hasClass("tm-current")){
		  $(this).removeClass("tm-current");
		  $('.img_zoom_box').stop(true, false).animate({
			  height:'0px',
              width:'0px'
			  }).hide(1);	 
	  }
	  else{
		  $('.img_zoom_box').stop(true, false).animate({
			  height:'0px',
              width:'0px'
			  }).hide(1);	
			  $('.content-img-list').removeClass("tm-current");
		  
		  $(".img-goleft").show();
		  $(".img-goright").show();
		  $(this).parent().parent().find('.content-img-list').removeClass("tm-current");
          $(this).addClass("tm-current");
		  var img = $(this).find("img").clone();
		  var screenImage = $(this).find("img");
		  var theImage = new Image();
		  theImage.src = screenImage.attr("src");
		  var imageWidth = theImage.width;
		  var imageHeight = theImage.height;
		  /*判断原图是否超过指定宽度*/
		  if(imageWidth>496){
			  var imageHeight = 496/imageWidth*theImage.height;
			  var imageWidth = 496;
		  }
		   $(this).parent().parent().find('.img_zoom_box').show().stop(true, false).animate({
			  height:imageHeight,
              width:imageWidth
			  });
		  $(this).parent().parent().find('.img-zoom-viewer').empty().prepend(img)
		  var lile = $(this).parent().parent().find('.content-img-list').length;
		  if($(this).parent().parent().find('.content-img-list').last().hasClass("tm-current")){
		     $(".img-goright").hide();
			 $(".img-goleft").show();
	       }
		  if($(this).parent().parent().find('.content-img-list').first().hasClass("tm-current")){
		     $(".img-goleft").hide();
			 $(".img-goright").show();
	      }
		  if(lile <= 1){
		     $(".img-goleft").hide();
			 $(".img-goright").hide();
	      }
	  }
    });
    $('.img-gomid').click(function() { 
	   $('.content-img-list').removeClass("tm-current");
	   $(this).parent().parent().find('.img_zoom_box').stop(true, false).animate({
			  height:'0px',
              width:'0px'
			  }).hide(1);	  
	});
   
	   $('.img-goright').click(function() { 
	      $('.tm-current').addClass("tm-go")
	      var img = $('.tm-current').next(".content-img-list").find("img").clone();
		  var screenImage = $('.tm-current').next(".content-img-list").find("img");
		  var theImage = new Image();
		  theImage.src = screenImage.attr("src");
		  var imageWidth = theImage.width;
		  var imageHeight = theImage.height;
		  /*判断原图是否超过指定宽度*/
		  if(imageWidth>496){
			  var imageHeight = 496/imageWidth*theImage.height;
			  var imageWidth = 496;
		  }
		   $(this).parent().parent().find('.img_zoom_box').show().stop(true, false).animate({
			  height:imageHeight,
              width:imageWidth
			  });
		   $(this).parent().parent().find('.img-zoom-viewer').empty().prepend(img);
		   $('.tm-current').next(".content-img-list").addClass("tm-current").prev().removeClass("tm-current");
		   
		   if($(this).parent().parent().find('.content-img-list').last().hasClass("tm-current")){
		     $(".img-goright").hide();
			 $(".img-goleft").show();
	       }
		   else{
			 $(".img-goright").show();
			 $(".img-goleft").show();
		   }
	   });	   
	   $('.img-goleft').click(function() { 
	      var img = $('.tm-current').prev(".content-img-list").find("img").clone();
		  var screenImage = $('.tm-current').prev(".content-img-list").find("img");
		  var theImage = new Image();
		  theImage.src = screenImage.attr("src");
		  var imageWidth = theImage.width;
		  var imageHeight = theImage.height;
		   /*判断原图是否超过指定宽度*/
		  if(imageWidth>496){
			  var imageHeight = 496/imageWidth*theImage.height;
			  var imageWidth = 496;
		  }
		   $(this).parent().parent().find('.img_zoom_box').show().stop(true, false).animate({
			  height:imageHeight,
              width:imageWidth
			  });
		   $(this).parent().parent().find('.img-zoom-viewer').empty().prepend(img);
		   $('.tm-current').prev(".content-img-list").addClass("tm-current").next().removeClass("tm-current");
		   if($(this).parent().parent().find('.content-img-list').first().hasClass("tm-current")){
		     $(".img-goleft").hide();
			 $(".img-goright").show();
	       }
		   else{
			 $(".img-goright").show();
			 $(".img-goleft").show();
		   }
	   });	
});
</script>

※本代码为原创代码,如需转载请注明出处:www.wikimoe.com

donate.png

1210 x 50(蓝底).png

cloudcone