利用jquery实现图片闪光幻灯片



45 176 59



特效描述:利用jquery实现 图片闪光 幻灯片,利用jquery实现图片闪光幻灯片

代码结构

1. 引入CSS

<link rel="stylesheet" type="text/css" href="styles.css">
<link rel="stylesheet" type="text/css" href="styles.css">

2. 引入JS

<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/cufon-yui.js"></script>
<script type="text/javascript" src="fonts/aura_400.font.js"></script>
<script defer type="text/javascript" src="js/pngfix.js"></script>
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/cufon-yui.js"></script>
<script type="text/javascript" src="fonts/aura_400.font.js"></script>
<script defer type="text/javascript" src="js/pngfix.js"></script>

3. HTML代码

<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="styles.css"></link>
<!--[if lt IE 7]>
<![endif]--> 
</head>
<script type="text/javascript">
  $(document).ready(function()
  {
	 /*Your ShineTime Welcome Image*/
	 var default_image = 'images/large/default.jpg';
	 var default_caption = 'Welcome to ShineTime';
	 /*Load The Default Image*/
	 loadPhoto(default_image, default_caption);
	 function loadPhoto($url, $caption)
	 {
	    /*Image pre-loader*/
	    showPreloader();
	    var img = new Image();
	    jQuery(img).load( function() 
		{
			jQuery(img).hide();
			hidePreloader();
        }).attr({ "src": $url });
	    $('#largephoto').css('background-image','url("' + $url + '")');
		$('#largephoto').data('caption', $caption);
	 }
	 /* When a thumbnail is clicked*/
	 $('.thumb_container').click(function()
	 {
		  var handler = $(this).find('.large_image');
		  var newsrc  = handler.attr('src');
		  var newcaption  = handler.attr('rel');
		  loadPhoto(newsrc, newcaption);
	 });
	 /*When the main photo is hovered over*/
	 $('#largephoto').hover(function()
	 {
		var currentCaption  = ($(this).data('caption'));
		var largeCaption = $(this).find('#largecaption');
		largeCaption.stop();
		largeCaption.css('opacity','0.9');
		largeCaption.find('.captionContent').html(currentCaption);
		largeCaption.fadeIn()
		 largeCaption.find('.captionShine').stop();
         largeCaption.find('.captionShine').css("background-position","-550px 0"); 
         largeCaption.find('.captionShine').animate({backgroundPosition: '550px 0'},700);
		 Cufon.replace('.captionContent');
	 },
	 function()
	 {
	    var largeCaption = $(this).find('#largecaption');
		largeCaption.find('.captionContent').html('');
		largeCaption.fadeOut();
	 });
     /* When a thumbnail is hovered over*/
	 $('.thumb_container').hover(function()
	 {  
         $(this).find(".large_thumb").stop().animate({marginLeft:-7, marginTop:-7},200);
		 $(this).find(".large_thumb_shine").stop();
         $(this).find(".large_thumb_shine").css("background-position","-99px 0"); 
         $(this).find(".large_thumb_shine").animate({backgroundPosition: '99px 0'},700);
	 }, function()
	 {
	    $(this).find(".large_thumb").stop().animate({marginLeft:0, marginTop:0},200);
	 });
	 function showPreloader()
	 {
	   $('#loader').css('background-image','url("images/interface/loader.gif")');
	 }
	 function hidePreloader()
	 {
	   $('#loader').css('background-image','url("")');
	 }
  });
</script>
<div id="container">
<div id="containertitle">
Welcome to ShineTime
</div>
   <div class="mainframe">
      <div id="largephoto">
	  <div id="loader"></div>
	    <div id="largecaption">
		 <div class="captionShine"></div>
		   <div class="captionContent"></div>
		</div>
       <div id="largetrans">  
      </div>
      </div>
   </div>
   <div class="thumbnails">
   <br><br><br>
   <!-- start entry-->
                    <div class="thumbnailimage">
                        <div class="thumb_container"> 
                            <div class="large_thumb"> 
                        		<img src="images/thumbnails/sample1.jpg" class="large_thumb_image" alt="thumb" /> 
                                <img src="images/large/sample1.jpg" class="large_image" rel="Just because I can't code, doesn't mean I can't kick your ass!" />
                                <div class="large_thumb_border"></div>
                                <div class="large_thumb_shine"></div>
                              </div>
						</div>
                       </div>
       <!--end entry-->          
   <!-- start entry-->
                    <div class="thumbnailimage">
                        <div class="thumb_container"> 
                            <div class="large_thumb"> 
                        		<img src="images/thumbnails/sample2.jpg" class="large_thumb_image" alt="thumb" /> 
                                <img src="images/large/sample2.jpg" class="large_image" rel="Kick-Ass Is In Theatres Everywhere Now" />
                                <div class="large_thumb_border"></div>
                                <div class="large_thumb_shine"></div>
                              </div>
						</div>
                       </div>
       <!--end entry-->          
   <!-- start entry-->
                    <div class="thumbnailimage">
                        <div class="thumb_container"> 
                            <div class="large_thumb"> 
                        		<img src="images/thumbnails/sample3.jpg" class="large_thumb_image" alt="thumb" /> 
                                <img src="images/large/sample3.jpg" class="large_image" rel="I can't see through walls, but I can still kick your ass." />
                                <div class="large_thumb_border"></div>
                                <div class="large_thumb_shine"></div>
                              </div>
						</div>
                       </div>
       <!--end entry-->           
   <!-- start entry-->
                    <div class="thumbnailimage">
                        <div class="thumb_container"> 
                            <div class="large_thumb"> 
                        		<img src="images/thumbnails/sample4.jpg" class="large_thumb_image" alt="thumb" /> 
                                <img src="images/large/sample4.jpg" class="large_image" rel="I won't bite, I promise!" />
                                <div class="large_thumb_border"></div>
                                <div class="large_thumb_shine"></div>
                              </div>
						</div>
                       </div>
       <!--end entry-->           
   <!-- start entry-->
                    <div class="thumbnailimage">
                        <div class="thumb_container"> 
                            <div class="large_thumb"> 
                        		<img src="images/thumbnails/sample5.jpg" class="large_thumb_image" alt="thumb" /> 
                                <img src="images/large/sample5.jpg" class="large_image" rel="Using swords to open up that ketchup bottle may not have been the best idea.." />
                                <div class="large_thumb_border"></div>
                                <div class="large_thumb_shine"></div>
                              </div>
						</div>
                       </div>
       <!--end entry-->          
   <!-- start entry-->
                    <div class="thumbnailimage">
                        <div class="thumb_container"> 
                            <div class="large_thumb"> 
                        		<img src="images/thumbnails/sample6.jpg" class="large_thumb_image" alt="thumb" /> 
                                <img src="images/large/sample6.jpg" class="large_image" rel="We're going to..wait for it..kick your ass!" />
                                <div class="large_thumb_border"></div>
                                <div class="large_thumb_shine"></div>
                              </div>
						</div>
                       </div>
       <!--end entry-->     
   <!-- start entry-->
                    <div class="thumbnailimage">
                        <div class="thumb_container"> 
                            <div class="large_thumb"> 
                        		<img src="images/thumbnails/sample7.jpg" class="large_thumb_image" alt="thumb" /> 
                                <img src="images/large/sample7.jpg" class="large_image" rel="I can't be invisible, but I can kick your ass." />
                                <div class="large_thumb_border"></div>
                                <div class="large_thumb_shine"></div>
                              </div>
						</div>
                       </div>
       <!--end entry-->    
   <!-- start entry-->
                    <div class="thumbnailimage">
                        <div class="thumb_container"> 
                            <div class="large_thumb"> 
                        		<img src="images/thumbnails/sample8.jpg" class="large_thumb_image" alt="thumb" /> 
                                <img src="images/large/sample8.jpg" class="large_image" rel="Dave Lizewski is a man in a green costume. He is Kick-Ass." />
                                <div class="large_thumb_border"></div>
                                <div class="large_thumb_shine"></div>
                              </div>
						</div>
                       </div>
       <!--end entry-->  
   <!-- start entry-->
                    <div class="thumbnailimage">
                        <div class="thumb_container"> 
                            <div class="large_thumb"> 
                        		<img src="images/thumbnails/sample9.jpg" class="large_thumb_image" alt="thumb" /> 
                                <img src="images/large/sample9.jpg" class="large_image" rel="I probably shouldn't have yelled 'surprise' wearing this costume.." />
                                <div class="large_thumb_border"></div>
                                <div class="large_thumb_shine"></div>
                              </div>
						</div>
                       </div>
       <!--end entry-->    	   
   <!-- start entry-->
                    <div class="thumbnailimage">
                        <div class="thumb_container"> 
                            <div class="large_thumb"> 
                        		<img src="images/thumbnails/sample10.jpg" class="large_thumb_image" alt="thumb" /> 
                                <img src="images/large/sample10.jpg" class="large_image" rel="I can't read your mind, but I can kick your ass." />
                                <div class="large_thumb_border"></div>
                                <div class="large_thumb_shine"></div>
                              </div>
						</div>
                       </div>
       <!--end entry-->    	
   <!-- start entry-->
                    <div class="thumbnailimage">
                        <div class="thumb_container"> 
                            <div class="large_thumb"> 
                        		<img src="images/thumbnails/sample11.jpg" class="large_thumb_image" alt="thumb" /> 
                                <img src="images/large/sample11.jpg" class="large_image" rel="I love that indented text effect up there. Not bad.." />
                                <div class="large_thumb_border"></div>
                                <div class="large_thumb_shine"></div>
                              </div>
						</div>
                       </div>
       <!--end entry-->    	   
	   <!-- start entry-->
                    <div class="thumbnailimage">
                        <div class="thumb_container"> 
                            <div class="large_thumb"> 
                        		<img src="images/thumbnails/sample12.jpg" class="large_thumb_image" alt="thumb" /> 
                                <img src="images/large/sample12.jpg" class="large_image" rel="I got your a present. It's an Ass-Kicking." />
                                <div class="large_thumb_border"></div>
                                <div class="large_thumb_shine"></div>
                              </div>
						</div>
                       </div>
       <!--end entry-->    	   
	   <!-- start entry-->
                    <div class="thumbnailimage">
                        <div class="thumb_container"> 
                            <div class="large_thumb"> 
                        		<img src="images/thumbnails/sample13.jpg" class="large_thumb_image" alt="thumb" /> 
                                <img src="images/large/sample13.jpg" class="large_image" rel="You don't have to be super to be a hero." />
                                <div class="large_thumb_border"></div>
                                <div class="large_thumb_shine"></div>
                              </div>
						</div>
                       </div>
       <!--end entry-->  
	   <!-- start entry-->
                    <div class="thumbnailimage">
                        <div class="thumb_container"> 
                            <div class="large_thumb"> 
                        		<img src="images/thumbnails/sample15.jpg" class="large_thumb_image" alt="thumb" /> 
                                <img src="images/large/sample15.jpg" class="large_image" rel="We Can Kick Ass - Anytime, Anyday." />
                                <div class="large_thumb_border"></div>
                                <div class="large_thumb_shine"></div>
                              </div>
						</div>
                       </div>
       <!--end entry-->  
	   <!-- start entry-->
                    <div class="thumbnailimage">
                        <div class="thumb_container"> 
                            <div class="large_thumb"> 
                        		<img src="images/thumbnails/sample14.jpg" class="large_thumb_image" alt="thumb" /> 
                                <img src="images/large/sample14.jpg" class="large_image" rel="You know..I had this look first. Batman copied ME." />
                                <div class="large_thumb_border"></div>
                                <div class="large_thumb_shine"></div>
                              </div>
						</div>
                       </div>
       <!--end entry-->    	 
   </div>
</div>
<div style="text-align:center;clear:both">
</div>
</html>



用户评论
大牛,别默默的看了,快登录帮我点评一下吧!:)      登录 | 注册


热门标签: 导航切换 带标题的焦点图 缩略图 带缩略图的幻灯片 图片相册 带简介的焦点图 图片切换 图片轮播 图片墙 文字切换 自动滚动图片轮播 百叶窗 背景切换 图片网格 马赛克幻灯片 手风琴 图片九宫格 全屏焦点图 选项卡自动切换 视频切换 图片高亮 列表切换 图片对比 图片文字 渐隐切换 单排图片 全屏切换 响应式图片 切换按钮 图片列表 缩放切换 图片拖动 图片放大镜 图片叠加 图片翻转旋转 图片延迟加载 图片淡出淡进 图片全屏 图片头像上传 二维码 滚动切换 滑动选项卡切换 图片广告 图片放大缩小 html5图片动画 带缩略图的幻灯片 地图 flash焦点图 图片滚动 图片滑动 图片切换 图片收缩展开 旋转木马 图片轮播 自动滚动图片轮播 图标导航菜单 选项卡切换 滑动手风琴 背景切换 手风琴 图表 焦点图幻灯片 图片 头像截图

×
×

注册

官方QQ群

扫描上面二维码加微信群

官方QQ群

jQuery/js讨论群
群号:642649996
Css3+Html5讨论群
群号:322131262

加群请备注:从官网了解到