从jQueryTools的scrollable中添加和删除项目

时间:2011-02-08 00:10:47

标签: javascript jquery jquery-tools scrollable

我有一个简单的想要...从另一个添加到一个可滚动的...这意味着这里的文档容易添加..但删除..没有运气..我可以移动但可滚动没有反映在导航或左侧权利..这是我到目前为止所尝试的..

    $(function() {
          // initialize scrollable
          $("#Unused.scrollable").scrollable({easing: 'easeOutBack'});
          $("#Unused.scrollable").navigator();

          $("#Used.scrollable").scrollable({easing: 'easeOutBack'});
          $("#Used.scrollable").navigator();

          $(".scrollable input[type='checkbox']").live('click',function(){
                var package=$("input[name='multiInput-module-0-Selected']").val();
                $("input[name='multiInput-module-0-Selected']").val('');
                $(this).closest('.scrollable').find("input[type='checkbox']").each(function(index, Element) {
                  if($(this).attr("checked")==true){
                        if(package==''){var c=''}else{var c=','}
                        package+=c+$(this).val();
                  }
                });
                var api = $("#Used.scrollable").data("scrollable");
                api.addItem($(this).closest('.img').clone()).end();
                $(this).closest('.img').remove();
                $("#Unused.scrollable").removeData();
                $("#Unused.scrollable").scrollable().navigator();
                $("input[name='multiInput-module-0-Selected']").val($.trim(package));
          });
          $("ul.tabs").tabs("div.panels > div.panel");
    });

和html

    <ul class="tabs">
      <li><a href="#">Used images</a></li>
      <li><a href="#">Add an image</a></li>
    </ul>
    <div class="panels">
    <div class='panel'>
    <h2>Used</h2>
    <div class="navi" ></div>
    <a class="prev browse left"></a>
    <div id='Used' class="scrollable">
      <div class="items">
        <div class='img' >
          <input type='checkbox' value='/uploads/siteTheme/headerimages/1.jpg' checked='checked'/>
          <a href='#' class='addtext' style=''>T</a> <img src='http://localhost/www.glts.tec.ma.us/uploads/SuperSizerTmp/admin/headerimages/1.-w100-h0-p0-q85-F-----S1-c.jpg?1296899993' alt='' /> </div>
        <div class='img' >
          <input type='checkbox' value='/uploads/siteTheme/headerimages/2.jpg' checked='checked'/>
          <a href='#' class='addtext' style=''>T</a> <img src='http://localhost/www.glts.tec.ma.us/uploads/SuperSizerTmp/admin/headerimages/2.-w100-h0-p0-q85-F-----S1-c.jpg?1296899993' alt='' /> </div>
        <!-- "next page" action -->
        <a class="next browse right"></a> </div>
      <div class='panel'>
        <h2 style='clear:both;'>Unused</h2>
        <div class="navi" ></div>
        <!-- "previous page" action -->
        <a class="prev browse left"></a>
        <!-- root element for scrollable -->
        <div id='Unused' class="scrollable">
          <!-- root element for the items -->
          <div class="items">
            <div class='img' >
              <input type='checkbox' value='/uploads/siteTheme/headerimages/1 - Copy.jpg' />
              <img src='http://localhost/www.glts.tec.ma.us/uploads/SuperSizerTmp/admin/headerimages/1 - Copy.-w100-h0-p0-q85-F-----S1-c.jpg?1296900411' alt='' /> </div>
            <div class='img' >
              <input type='checkbox' value='/uploads/siteTheme/headerimages/2 - Copy.jpg' />
              <img src='http://localhost/www.glts.tec.ma.us/uploads/SuperSizerTmp/admin/headerimages/2 - Copy.-w100-h0-p0-q85-F-----S1-c.jpg?1296900411' alt='' /> </div>
          </div>
        </div>
        <!-- "next page" action -->
        <a class="next browse right"></a> </div>
      <div style='clear:both;'></div>
    </div>

我确信这很简单..一些解决方法..只是没有找到它或得到它:D感谢你的帮助..干杯 - 杰里米