jquery版结婚电子请帖

老姐看了jquery版小型婚礼(可动态添加祝福语),觉得还不错,就让我给他们做一个电子请帖。已经做了大半年了,懒着一直没发……趁现在想起来了,就赶紧放上来让大家看看。

一、图片展示

1.开场动画

新人开着小轿车缓缓向我们驶来,从这头到那头,其中的滋味醉在心头。

2.首页

首页包括相册、邀请函、祝福墙和婚礼地址。

1).相册

相册集,由12张小图片组成一个心形,图片自循环逐张变大再变小。

2).邀请函

两情相悦只要证到手,又启在朝朝暮暮。

3).祝福墙

祝福墙动画:

留言板:

4).婚礼地址

#p#

二、代码展示

1.html代码

 
 
  1.  
  2.  
  3.    
  4.        
  5.      
  6.      
  7.      
  8.    
  9.    
  10.    
  11.    
  12.      
  13.          
  14.          
  15.              
  16.              
  17.         
 
  •  
  •          
  •          
  •              
  •                 
       
    •                     
    • 相册
    •  
    •                     
    • 邀请函
    •  
    •                     
    • 祝福墙
    •  
    •                     
    • 婚礼地点
    •  
    •                 
     
  •             
  •  
  •         
  •  
  •  
  •          
  •          
  •              
  •              
  •              
  •          
  •  
  •          
  •          
  •             
     
  •             
     
  •             
     
  •             
     
  •             
     
  •          
  •  
  •          
  •          
  •             
     
  •             
     
  •             
     
  •             
     
  •             
     
  •             
     
  •             
     
  •             
     
  •             
     
  •             
     
  •             
     
  •             
     
  •             
     
  •             
     
  •             
     
  •             
     
  •          
  •  
  •          
  •          
  •              
  •             点我送祝福 
  •              
  •                  
  •                  
  •                  
  •                  
  •                  
  •                  
  •                  
  •                  
  •                  
  •                  
  •                  
  •                  
  •                 一定要幸福哦~ 
  •                 祝你们白头偕老! 
  •                 早生贵子~ 
  •                 新婚快乐~ 
  •                 生个宝宝认我做干妈! 
  •                 喜结良缘O(∩_∩)O哈哈哈~ 
  •                 一定要幸福哦~ 
  •                 祝你们白头偕老! 
  •                 早生贵子~ 
  •                 新婚快乐~ 
  •                 生个宝宝认我做干妈! 
  •                 喜结良缘O(∩_∩)O哈哈哈~ 
  •              
  •          
  •  
  •  
  •          
  •          
  •              
  •              
  •              
  •              
  •              
  •              
  •              
  •              
  •              
  •              
  •              
  •              
  •              
  •          
  •  
  •  
  •          
  •          
  •              
  •              
  •              
  •          
  •  
  •      
  •  
  •      
  •      
  •      
  •         

    送上祝福语

     
  •         写上您的祝福吧~ 
  •         确定 
  •      
  •  
  •      
  •      
  •          
  •          
  •          
  •          
  •      
  •  
  •      
  •      
  •      
  •  
  •    
  •  
  •  

    2.js代码

     
     
    1. var sceneObject = { 
    2.     init: function(){ 
    3.         this._enterCar(); 
    4.         this._enterInvitation(); 
    5.         this._enterAlbum(); 
    6.         this._enterWall(); 
    7.         this._addBlessing(); 
    8.         this._searchAddress(); 
    9.     }, 
    10.     /*---------------------------------移动的婚车------------------------------*/ 
    11.     _enterCar: function(){ 
    12.         initCar(); 
    13.  
    14.         /* 婚车随着窗口大小改变 */ 
    15.         $(window).resize(function(){ 
    16.             setCarPosition(); 
    17.         }) 
    18.     }, 
    19.     /*---------------------------------进入邀请函------------------------------*/ 
    20.     _enterInvitation: function(){ 
    21.          var $home = $(".home"), /* 首页 */ 
    22.             $toInvitation = $("#to-invitation"), /* 邀请函按钮 */ 
    23.             $invitation = $(".invitation"), /* 邀请函模块 */ 
    24.             $invitationCt = $(".invitation-content"), /* 邀请函内容 */ 
    25.             $inviteReturn = $("#invite-return"); 
    26.  
    27.         $toInvitation.click(function(){ 
    28.             $home.fadeOut(); /* 隐藏首页 */ 
    29.             $invitation.fadeIn(); 
    30.             $invitationCt.animate({"top": "0"},function(){ 
    31.                 $inviteReturn.fadeIn(); 
    32.             }); 
    33.         }) 
    34.          
    35.         /* 邀请函中点击返回按钮 */ 
    36.         $inviteReturn.click(function(){ 
    37.             $invitationCt.css({"top": "-540px"}); 
    38.             $invitation.fadeOut(function(){ 
    39.                 $inviteReturn.fadeOut(); 
    40.                 $home.fadeIn(600); 
    41.             }); 
    42.         }) 
    43.     }, 
    44.      /*---------------------------------进入相册------------------------------*/ 
    45.     _enterAlbum: function(){ 
    46.         var $home = $(".home"), /* 首页 */ 
    47.              $toPicture = $("#to-picture"), 
    48.              $pictureWall = $(".picture-wall"), 
    49.              timer; 
    50.  
    51.         $toPicture.click(function(){ 
    52.             $home.fadeOut(function(){/* 隐藏首页 */ 
    53.                 $pictureWall.fadeIn(); /* 显示相册 */ 
    54.                 autoPicWall(); 
    55.                 timer = setInterval(autoPicWall,4000); /* 照片自动播放 */ 
    56.             }); 
    57.         }) 
    58.  
    59.         /* 点击照片墙中返回按钮 */ 
    60.         $("#picture-return").click(function(){ 
    61.             clearInterval(timer); /* 返回首页时清除循环 */ 
    62.             picPage = 0; /* 并且显示图片为0,也就是下一次进入时又从0开始 */ 
    63.             $pictureWall.fadeOut(function(){ 
    64.                 $home.fadeIn(); 
    65.             }) 
    66.         }) 
    67.     }, 
    68.      /*---------------------------------进入祝福墙-------------------------------*/ 
    69.     _enterWall: function(){ 
    70.         var $home = $(".home"), 
    71.                 $uEnter = $("#to-wall"); /* 进入祝福墙按钮 */ 
    72.                  
    73.  
    74.         $uEnter.click(function(){ 
    75.             $home.hide(); 
    76.             setTimeout(scene6,400); /* 进入祝福墙场景动画 */ 
    77.         }) 
    78.     }, 
    79.     /*---------------------------------添加祝福语-------------------------------*/ 
    80.     _addBlessing: function(){ 
    81.            var $home = $(".home"), 
    82.                 $sevenDiv = $(".seven-content div"), 
    83.                 $clickMe = $(".clickMe"), 
    84.                 $mask = $(".mask"), 
    85.                 $popBox = $(".pop-box"), 
    86.                 $write = $("#write"), 
    87.                 $uSure = $("#uSure"), 
    88.                 $sevenContent = $(".seven-content"); 
    89.  
    90.         /* 拖动祝福卡片 */ 
    91.         draggableNote(); 
    92.  
    93.          /* 点我送祝福 */ 
    94.         $clickMe.click(function(){ 
    95.             $write.val("送上您的祝福吧~"); 
    96.             $mask.fadeIn(); 
    97.             $popBox.animate({top: "50%"}); 
    98.         }) 
    99.  
    100.         /* 获取焦点时 */ 
    101.         $write.focus(function(){ 
    102.             var _val = $(this).val(); 
    103.             if(_val == "送上您的祝福吧~"){ 
    104.                 $(this).val(""); 
    105.             } 
    106.         }) 
    107.         /* 丢失焦点时 */ 
    108.         $write.blur(function(){ 
    109.             var _val = $(this).val(); 
    110.             if(_val.length == 0){ 
    111.                 $(this).val("送上您的祝福吧~"); 
    112.             } 
    113.         }) 
    114.  
    115.         /* 确定添加祝福语 */ 
    116.         $uSure.click(function(){ 
    117.             var _writeVal = $write.val(), 
    118.                  _randomNum = Math.ceil(Math.random()*6); 
    119.  
    120.             if(_writeVal != "送上您的祝福吧~"){ 
    121.                 var _div = ''+_writeVal+''; 
    122.                 $sevenContent.append(_div); /* 如果输入祝福语,将此标签添加的尾部 */ 
    123.                 defineSevenDiv($sevenContent.find("div:last")); 
    124.                 $popBox.animate({top: "-300px"},function(){ 
    125.                     $mask.fadeOut(); 
    126.                     draggableNote(); /* 可拖动卡片,给新添加的标签赋予拖动功能 */ 
    127.                 }); 
    128.             }else{ 
    129.                 alert("请输入祝福语!"); 
    130.             } 
    131.         }) 
    132.  
    133.         /* 祝福墙中返回首页 */ 
    134.         $("#blessing-return").click(function(){ 
    135.             $(".seven-box").fadeOut(function(){ 
    136.                 $home.fadeIn(); 
    137.             }) 
    138.         }) 
    139.     }, 
    140.      /*---------------------------------查看婚礼地址-------------------------------*/ 
    141.     _searchAddress: function(){ 
    142.         var $home = $(".home"), 
    143.              $toAddress = $("#to-address"); /* 婚礼地址导航 */ 
    144.              $address = $(".address"), /* 婚礼地址图 */ 
    145.              $addressReturn = $("#address-return"); 
    146.  
    147.         $toAddress.click(function(){ 
    148.             $home.fadeOut(); 
    149.             $address.fadeIn(); 
    150.         }) 
    151.  
    152.         /* 婚礼地址返回首页 */ 
    153.         $addressReturn.click(function(){ 
    154.             $address.fadeOut(); 
    155.             $home.fadeIn(); 
    156.         }) 
    157.     } 
    158.  
    159.  
    160. /*---------------------------------移动的小车-------------------------------*/ 
    161. function initCar(){ 
    162.     var $home = $(".home"); /* 首页 */ 
    163.     setCarPosition(); 
    164.     setTimeout(function(){ 
    165.         $home.fadeIn(); 
    166.     },6500); 
    167.  
    168. /* 婚车位置定位和滑动方法 */ 
    169. function setCarPosition(){ 
    170.     var $car = $(".car"), 
    171.           wWidth = $(window).width(), /* 文档宽度 */ 
    172.           wHeight = $(window).height(), /* 窗口高度 */ 
    173.           carWidth = $car.height(), /* 婚车宽度 */ 
    174.           carHeight = $car.height(); /* 婚车高度 */ 
    175.     $car.css({top:wHeight - carHeight - 100}); 
    176.     $car.animate({left: wWidth - carWidth + 100},8000).fadeOut(); 
    177.  
    178.  
    179. /*---------------------------------图片墙-------------------------------*/ 
    180. var  picPage = 0, /* 当前是第几张图片放大和缩小 */ 
    181.        picLeft, /* 图片左边距离 */ 
    182.        picTop; /* 图片上部定位距离 */ 
    183.  
    184. /* 自动放大缩小图片方法 */ 
    185. function autoPicWall(){ 
    186.     var $pictureWallPic = $(".picture-wall div"), 
    187.          $own = $pictureWallPic.eq(picPage), 
    188.          isBig = $own.hasClass("bigCenter"), /* 放大时有这个class */ 
    189.          hasClassPicRow = $own.hasClass("picRow"); /* 判断图片是行的(就是宽大于高) */ 
    190.  
    191.     /* 调用图片放大 */ 
    192.     becomeBig($own,hasClassPicRow); 
    193.  
    194.     /* 隔2秒图片自动缩小 */ 
    195.     setTimeout(function(){becomeSmall($own,hasClassPicRow);},2000); 
    196.  
    197.     /* 保证当前放大图片为图片总个数内,也就是说存在这个图片 */ 
    198.     if(picPage < $pictureWallPic.length - 1){ 
    199.         picPage++; 
    200.     }else if(picPage == $pictureWallPic.length - 1){ /* 如果当前图片为***一张图片,则又从***张图片开始显示 */ 
    201.         picPage = 0; 
    202.     } 
    203.  
    204.  
    205. /* 图片变大方法 */ 
    206. function becomeBig($own,hasClassPicRow){ 
    207.     var $mask = $(".mask"), 
    208.           pictureWallWidth = $(".picture-wall").width(), 
    209.           pictureWallHeight = $(".picture-wall").height(); 
    210.  
    211.     picLeft = $own.css("left"); /* 原始绝对定位left值 */ 
    212.     picTop = $own.css("top"); /* 原始绝对定位top值 */ 
    213.     $own.toggleClass("bigCenter"); /* 添加放大的class属性 */ 
    214.     $mask.fadeIn(); 
    215.  
    216.     /* 图片为行图片,也就是宽度大于高度 */ 
    217.     if(hasClassPicRow){ 
    218.         for(var i = 120; i < 720; i+=20){ 
    219.             $own.find("img").animate({"width": i+"px", "height": i/1.5+"px"},2); 
    220.             $own.animate({"left": (pictureWallWidth-i)/2+"px", "top": (pictureWallHeight-i/1.5)/2+"px"},2); 
    221.         } 
    222.     }else{ 
    223.         for(var i = 80; i < 480; i+=20){ 
    224.             $own.find("img").animate({"width": i+"px", "height": i*1.5+"px"},2); 
    225.             $own.animate({"left": (pictureWallWidth-i)/2+"px", "top": (pictureWallHeight-i*1.5)/2+"px"},2); 
    226.         } 
    227.     } 
    228.  
    229. /* 图片缩小方法 */ 
    230. function becomeSmall($own,hasClassPicRow){ 
    231.     var $mask = $(".mask"), 
    232.           pictureWallWidth = $(".picture-wall").width(), 
    233.           pictureWallHeight = $(".picture-wall").height(); 
    234.  
    235.     if(hasClassPicRow){ 
    236.         for(var i = 720; i >= 120; i-=40){ 
    237.             $own.find("img").animate({"width": i+"px", "height": i/1.5+"px"},2); 
    238.             /* 图片缩小到中心位置 */ 
    239.             $own.animate({"left": (pictureWallWidth-i)/2+"px", "top": (pictureWallHeight-i/1.5)/2+"px"},2); 
    240.         } 
    241.     }else{ 
    242.         for(var i = 480; i >= 80; i-=40){ 
    243.             $own.find("img").animate({"width": i+"px", "height": i*1.5+"px"},2); 
    244.             /* 图片缩小到中心位置 */ 
    245.             $own.animate({"left": (pictureWallWidth-i)/2+"px", "top": (pictureWallHeight-i*1.5)/2+"px"},2); 
    246.         } 
    247.     } 
    248.      
    249.     /* 图片缩小到中心位置后,回到原始位置 */ 
    250.     $own.animate({"left": picLeft, "top": picTop},400,function(){ 
    251.         $mask.fadeOut(); /* 隐藏遮罩层 */ 
    252.         $own.toggleClass("bigCenter"); /* 去除放大的class属性 */ 
    253.     }); 
    254.  
    255.  
    256.                  
    257. /*---------------------------------祝福墙进入动画-------------------------------*/ 
    258. var colCount = 4, /* 多少列 */ 
    259.         rowCount = 4, /* 多少行 */ 
    260.      

      标题名称:jquery版结婚电子请帖
      转载来源:http://www.shufengxianlan.com/qtweb/news20/378170.html

      网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等

      广告

      声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联