相册js

  1. .photopagelist{
  2.     width:83px;
  3.     border-width:20px 1px;
  4.     border-color:#ccc;
  5.     border-style:solid;
  6. }
  7. .prepage{
  8.     width:83px;
  9.     height:20px;
  10.     *width:83px;
  11.     border:1px solid #ccc;
  12.     border-width:1px 0px;
  13.     background-color:#ffffff;
  14.     position:relative;
  15.     z-index:2px;
  16.     margin-top:-20px;
  17.     cursor:pointer;
  18.     background-image:url(../img/arrow_5.gif);
  19.     background-position:  50% 50%;
  20.     background-repeat:no-repeat;
  21. }
  22. .prepage:hover, .prepagehover{
  23.     background-image:url(../img/arrow_6.gif);
  24. }
  25. .nextpage{
  26.     width:83px;
  27.     height:20px;
  28.     *width:83px;
  29.     border:1px solid #ccc;
  30.     border-width:1px 0px;
  31.     background-color:#ffffff;
  32.     margin-bottom:-20px;
  33.     position:relative;
  34.     z-index:2px;
  35.     display:block;
  36.     cursor:pointer;
  37.     background-image:url(../img/arrow_0.gif);
  38.     background-position:  50% 50%;
  39.     background-repeat:no-repeat;
  40. }
  41. .nextpage:hover, .nextpagehover{
  42.     background-image:url(../img/arrow_7.gif);
  43. }
  44. .photopagelist li {
  45.     width:78px;
  46.     *width:76px;
  47.     margin:1px;
  48.     padding3px 1px;
  49.     vertical-align:middle;
  50.     line-height:auto;
  51.     text-align:center;
  52.     displayblock;
  53.     cursor:pointer;
  54. }
  55. .photopagelist li img {
  56.     margin:0px;
  57.     padding:0px;
  58. }



  1. <script language="javascript" type="text/javascript" >
  2. var photoList = {"14942095c3d5c0":{"id":"5792367206716864","intro":"1680","ctime":"08-12-12 14:50","view":"16","comm":"0","photo":"http:www.1000lin.my//img//14942095c3d5c0_21.jpg"},"149420abe06b28":{"id":"5792367577688872","intro":"1680 (1)","ctime":"08-12-12 14:56","view":"19","comm":"0","photo":"http:www.1000lin.my//img//149420abe06b28_21.jpg"},"149420ace50850":{"id":"5792367594768464","intro":"1680 (2)","ctime":"08-12-12 14:56","view":"15","comm":"0","photo":"http:www.1000lin.my//img//149420ace50850_21.jpg"},"149420ae942658":{"id":"5792367623022168","intro":"1680 (3)","ctime":"08-12-12 14:57","view":"16","comm":"0","photo":"http:www.1000lin.my//img//149420ae942658_21.jpg"},"149420af8e1606":{"id":"5792367639401990","intro":"1680 (4)","ctime":"08-12-12 14:57","view":"55","comm":"0","photo":"http:www.1000lin.my//img//149420af8e1606_21.jpg"},"149420b1a518a0":{"id":"5792367674464416","intro":"1680 (5)","ctime":"08-12-12 14:58","view":"21","comm":"0","photo":"http:www.1000lin.my//img//149420b1a518a0_21.jpg"}};
  3. var pospic = {'id':'','num':0, 'pn':{*$pn|default:0*}, 'total':{*$total|default:0*}};
  4. var init_photoList = function(){
  5.     if(photoList.length === 0) return false;
  6.         $('.photopagelist ul').html('');
  7.         $.each(photoList,function(i,_o){
  8.             _html = '<li id="'+i+'"><img src='+_o['photo']+' onload="showImgSize(/'/',/'75x75/',this)" onclick="changImage(/''+i+'/')" /></li>';
  9.             $(_html).appendTo('.photopagelist ul');
  10.             photoList[i]['position'] = ++pospic.num;
  11.         });  
  12.         $('.photopagelist li img').mouseover(function(){
  13.             $(this).css({opacity:"0.01"}).stop().animate({opacity:"1"},600);
  14.         });
  15.         
  16. }
  17. var changImage = function(_id){
  18.         showImage(_id);//增加和替换Image
  19.         pospic.id = _id;
  20.         $('.selpicli').removeClass('selpicli');
  21.         $('#'+_id,'.photopagelist').addClass('selpicli');
  22.         if(obj_id != _id) changcomment(_id);
  23.         photoList[_id]['_3'] = _img;
  24. }
  25. var changcomment = function(_id) {
  26.     obj_id = _id;
  27.     comm_ajax_page('{*$HOST*}comment.php?tab=' + tab + 'obj_id=' + obj_id + 'del_tag=yact=showpn=1');
  28. }
  29. var showImage =  function(_id){
  30.         $('img[id^=photoview_]','#photoview').hide();
  31.         $('#photoviewsrc').hide();
  32.         _img = photoList[_id]['photo'].replace('_21','_23');
  33.         
  34.         _infor = "上传时间:"+photoList[_id]['ctime']+" 浏览:"+photoList[_id]['view']+"  评论:"+photoList[_id]['comm'];
  35.         $('#photoinfo').html(_infor);
  36.         $('#photointro').html(photoList[_id]['intro']);
  37.         
  38.         if(photoList[_id]['_3'] != undefined) {
  39.             $('#photoview_'+_id).show();
  40.             return;
  41.         }
  42.         $('.loadingbar').show();
  43.         if($.browser.msie){
  44.                 $('.loadingbar').hide();
  45.                 $('<img src="'+_img+'" id="photoview_'+_id+'" />').load(function(){showImgSize('','480x360',this);}).appendTo('#photoview');        
  46.         } else {    
  47.             $('<img src="'+_img+'" id="photoview_'+_id+'" />').load(function(){
  48.                 $('.loadingbar').hide();
  49.                 showImgSize('','480x360',this);
  50.                 $(this).appendTo('#photoview');
  51.             });
  52.         }
  53.         photoList[_id]['_3'] = _img;
  54.         //更新点击数
  55.         //$.getJSON("{*$HOST*}photo.php?action=photo_ajaxact=addviewid="+_id);
  56. }
  57. var changpage = function(_pn){
  58.         $.getJSON("{*$HOST*}photo.php?action=photoshowuid={*$uid*}type=ajaxcate_id={*id_encode id=$cateinfo.fld_id*}pn="+_pn,function(_data){
  59.             if(_data[0] == 1) {
  60.                 photoList = _data[1];
  61.                 init_photoList();
  62.                 changImage($('.photopagelist li:first').attr('id'));
  63.             }
  64.         });
  65. }
  66. $().ready(function(){
  67.     $('.photodiv table img').mousemove(function(){
  68.         _id = $(this).attr('alt');
  69.         _title="上传时间:"+typeList[_id]['ctime']+",专辑:"+typeList[_id]['ctime']+"";
  70.         $(this).attr('title',_title);
  71.     }); 
  72.     $('#selPhotoAlbum').change(function(){
  73.         window.location.href='{*$HOST*}photo.php?action=photolist&uid={*$uid*}&cate_id='+$(this).val();
  74.     });
  75.     _r = init_photoList();
  76.     if(_r === false){
  77.         $('#photoListDiv,.content_link, .doact').hide();
  78.         $('#content').append(' <div class="content_link" style="padding-top:35%" >用户还没有上传任何相片!</div>');
  79.     }
  80.     $('#goprepic').click(function(){
  81.          
  82.          if(photoList[pospic.id]['position'] > 1) {
  83.             changImage($('#'+pospic.id).prev().attr('id'));
  84.          } else {//翻上一页 最后一个
  85.          
  86.          }
  87.     });
  88.     $('#gonextpic').click(function(){
  89.          if(photoList[pospic.id]['position'] < pospic.num) {
  90.             changImage($('#'+pospic.id).next().attr('id'));
  91.          } else {//翻下一页 第一个
  92.             
  93.          }
  94.     });
  95.     $('.prepage').hoverClass('prepagehover').click(function(){
  96.         if(pospic['pn'] == 1) return;
  97.         changpage(pospic['pn']-1);
  98.         pospic['pn']--;
  99.     });
  100.     $('.nextpage').hoverClass('nextpagehover').click(function(){
  101.         if(pospic['pn'] == pospic['total']) return;
  102.         changpage(pospic['pn']+1);
  103.         pospic['pn']++;
  104.     });
  105.     if(obj_id){ 
  106.         changImage(obj_id);
  107.     } else {
  108.         changImage($('.photopagelist li:first').attr('id'));
  109.     }
  110. });
  111. </script>

  112.       <div style="display: block;" id="photoshow">
  113.         <div style="width:490px;">
  114.           <table cellpadding="0px" cellspacing="0px" border="0px" height="360px" width="480px" align="center"  >
  115.             <tr>
  116.               <td colspan="2" id="photoview"><img  src="/view/img/480x360.gif" id="photoviewsrc" /><img src="/view/img/loading.gif" id="loadingbar" class="loadingbar hide"> </td>
  117.             </tr>
  118.             <tr>
  119.               <td colspan="2" id="photoinfo"></td>
  120.             </tr>
  121.             <tr>
  122.               <td colspan="2" id="photostate"></td>
  123.             </tr>
  124.             <tr>
  125.               <td colspan="2" id="photointro"></td>
  126.             </tr>
  127.           </table>
  128.         </div>
  129.       </div>
  130.       <div class="photopagelist right">
  131.         <div class="prepage"> </div>
  132.         <ul>
  133.         </ul>
  134.         <div class="nextpage"> </div>
  135.       </div>
  136.     </div>
  137.  </div>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值