图像上传后将图像放入滑块

时间:2011-08-13 12:38:49

标签: jquery image-uploading

我想制作,在图片上传后将图片放入滑块。但只阅读第一个工作代码。它有两个li元素并显示它。上传后li元素增加 这段代码easysliders代码。我给manuel的变量值,例如100.此后没有问题。如何在上传后设置s变量的自动值?。

CSS

<div id="container">
   <div id="content">
    <div id="slider">
     <ul>    
      <li><a href="http://templatica.com/preview/30"><img src="./img/01.jpg" alt="Css Template Preview" /></a></li>
      <li><a href="http://templatica.com/preview/30"><img src="./img/01.jpg" alt="Css Template Preview" /></a></li>
     </ul>
    </div>
   </div>
  </div>

图片上传

var uploader = $('#flashUploader').pluploadQueue();     
  uploader.bind('FileUploaded', function(up, file, response) {
   var obj = jQuery.parseJSON(response.response); 
    $('#slider ul').append("<li id="+obj.ramdom+"><img src='http://www.smyrnart.com/upl/" + obj.file + "'></li>")
   $("#slider").easySlider({
   a  : $("#slider ul li").length 
 });

 });

Easy Slider

this.each(function() {  
   var obj = $(this);  
   var s = options.a;
   alert(s);
   var w = $("li", obj).width(); 
   var h = $("li", obj).height(); 
   obj.width(w); 
   obj.height(h); 
   obj.css("overflow","hidden");
   var ts = s-1;
   var t = 0;
   $("ul", obj).css('width',s*w);   
   if(!options.vertical) $("li", obj).css('float','left');

   if(options.controlsShow){
    var html = options.controlsBefore;
    if(options.firstShow) html += '<span id="'+ options.firstId +'"><a href=\"javascript:void(0);\">'+ options.firstText +'</a></span>';
    html += ' <span id="'+ options.prevId +'"><a href=\"javascript:void(0);\">'+ options.prevText +'</a></span>';
    html += ' <span id="'+ options.nextId +'"><a href=\"javascript:void(0);\">'+ options.nextText +'</a></span>';
    if(options.lastShow) html += ' <span id="'+ options.lastId +'"><a href=\"javascript:void(0);\">'+ options.lastText +'</a></span>';
    html += options.controlsAfter;      
    $(obj).after(html);          
   };

   $("a","#"+options.nextId).click(function(){  
    animate("next",true);
   });
   $("a","#"+options.prevId).click(function(){  
    animate("prev",true);    
   }); 
   $("a","#"+options.firstId).click(function(){  
    animate("first",true);
   });    
   $("a","#"+options.lastId).click(function(){  
    animate("last",true);    
   });  

   function animate(dir,clicked){
    var ot = t;    
    switch(dir){
     case "next":
      t = (ot>=ts) ? (options.continuous ? 0 : ts) : t+1;      
      break; 
     case "prev":
      t = (t<=0) ? (options.continuous ? ts : 0) : t-1;
      break; 
     case "first":
      t = 0;
      break; 
     case "last":
      t = ts;
      break; 
     default:
      break; 
    }; 

感谢您的回答。

0 个答案:

没有答案