亚洲熟妇AV一区二区三区浪潮 ,亚洲免费日韩无码系列,亚洲国产精品日韩http://www.tkk7.com/fl1429/category/41356.htmlJava,Ruby,Php,Flex,Ajax,UI,Google,Twitter,Firefox,Ubuntu,Opensource,Designer,Blogger,Web2.0zh-cnTue, 02 Mar 2010 15:01:25 GMTTue, 02 Mar 2010 15:01:25 GMT60contentSlider DEMOhttp://www.tkk7.com/fl1429/archive/2010/03/01/314196.htmlfl1429fl1429Mon, 01 Mar 2010 11:32:00 GMThttp://www.tkk7.com/fl1429/archive/2010/03/01/314196.htmlhttp://www.tkk7.com/fl1429/comments/314196.htmlhttp://www.tkk7.com/fl1429/archive/2010/03/01/314196.html#Feedback0http://www.tkk7.com/fl1429/comments/commentRss/314196.htmlhttp://www.tkk7.com/fl1429/services/trackbacks/314196.html Wholesale – Buy China Wholesale Products from Chinese Wholesalers and Factories on BeeBuyer.com
<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>


    原文: http://www.wxianfeng.cn/2010/03/01/jquery-div-slider-plugin-contentslider1-0/ 真郁悶 , 我在wordpress中發表了 demo 會影響 整個主題的 樣式, 所以只有放這了 主站蜘蛛池模板: 国产猛男猛女超爽免费视频| 亚洲色无码专区一区| 国产综合亚洲专区在线| 免费一级毛片不卡在线播放| 免费jlzzjlzz在线播放视频| 免费国产高清视频| 免费成人av电影| 亚洲精品无码99在线观看| 亚洲国产成人五月综合网| 亚洲福利视频一区二区| 亚洲人成色7777在线观看不卡| 亚洲一区二区视频在线观看| 一本久久a久久精品亚洲| 亚洲国产精品无码一线岛国| 亚洲AV无码成人网站久久精品大| 亚洲va久久久噜噜噜久久男同| 久久精品国产精品亚洲艾草网| 亚洲精品在线观看视频| 亚洲国产日韩女人aaaaaa毛片在线| 亚洲国产成人手机在线电影bd| 在线综合亚洲欧洲综合网站 | 青青草国产免费久久久下载| 国产成人免费a在线视频色戒| 国产一级淫片a免费播放口之| 亚洲精品国精品久久99热| 一本久久a久久精品亚洲| 亚洲国产精品自在在线观看| 亚洲国产精品成人久久久| 亚洲欧美黑人猛交群| 国产天堂亚洲国产碰碰| 在线观看人成视频免费无遮挡| 久久青草免费91线频观看不卡 | 亚洲综合激情九月婷婷 | 亚洲国产人成精品| 亚洲熟女少妇一区二区| 亚洲一区二区三区电影| 亚洲人精品亚洲人成在线| 黄色免费网站在线看| 亚在线观看免费视频入口| 毛片免费全部播放一级| 免费日本黄色网址|

    fl1429 2010-03-01 19:32 發表評論
    ]]>Jquery pagination like twitter more buttonhttp://www.tkk7.com/fl1429/archive/2009/09/25/296448.htmlfl1429fl1429Fri, 25 Sep 2009 08:50:00 GMThttp://www.tkk7.com/fl1429/archive/2009/09/25/296448.htmlhttp://www.tkk7.com/fl1429/comments/296448.htmlhttp://www.tkk7.com/fl1429/archive/2009/09/25/296448.html#Feedback0http://www.tkk7.com/fl1429/comments/commentRss/296448.htmlhttp://www.tkk7.com/fl1429/services/trackbacks/296448.html
    效果和xiaonei的  更多新鮮事  一樣:


    前面有篇文章也介紹了一個像 twitter more 的方式分頁的方法,不過那個是用 protorype 做的。。那個做起來簡單一點,因為rails給我們封裝了 insert_html 和 link_to_remote 等方法,這樣更加便捷,但是解決jquery 和 prototype的confilct是一件很讓人頭疼的事,索性今天又實現了一個基于 jquery 的方法,環境是在rails中,需要使用 will_paginate 插件:
    Demo:

    view:

    <script>
    (function($){
        var settings;

        $.bottomlessPagination = function(callerSettings) {
            settings = $.extend({
                ajaxLoaderPath:'/images/loading.gif',
                results:'.results', // results 返回結果外部的class
                objName:'',
                callback:null
            },callerSettings||{});
            settings.imgLoader = new Image();
            settings.imgLoader.src = settings.ajaxLoaderPath;
            settings.href = $(".current").next().attr("href"); //current 是 will_paginate 默認的當前頁 href 的名字

            if ($('div.pagination').size() > 0){ // pagination 是 will_paginate 默認的 class
                $('div.pagination').wrap("<div class='pagination_links'></div>").hide();
                $('.pagination_links').append(
                    "<div class='live_pagination'>" +
                    "<a class='more_links' style='cursor:pointer;'> 查看 " + settings.objName + "...</a>" +
                    "</div>"
                    );
            }
       
            $(".more_links").click(function(){ 
                $(".live_pagination").hide();          
                if ($(".now_loading").size() == 0)              
                    $(".more_links").after("<img class='now_loading' src='"+settings.imgLoader.src+"' />");          
                else
                    $(".now_loading").show();           
                $.get(
                    settings.href,'',function(data){
                        $(settings.results).addrows(data);
                        $(".now_loading").hide();
                        $(".live_pagination").show();
                    }
                    );
                return false;
            });

            $.fn.addrows = function(data) {
                //remove live pagination if there are no more results
                // alert(data.length);
                if (data.length === 1 ){
                   // alert(data.length);
                    $('.live_pagination').remove();
                    $('.pagination_links').append(
                        "<div class='no_pagination'>" +
                        "沒有" + settings.objName +
                        "</div>"
                        );
                    return false;
                }
                //change the href
                ind=settings.href.indexOf("page=");
                page=parseInt(settings.href.charAt(ind+5))+1;
                start=settings.href.slice(0,ind+5);
                stop=settings.href.slice(ind+6);
                settings.href=start.concat(page.toString()).concat(stop);

                //add results to the page
                $(settings.results).append(data);
                if (settings.callback) settings.callback();
            };
        };
    })(jQuery);
    </script>


              <div class="results">
                <%= render :partial => 'activity' , :collection => @all_feed  %>
              </div>
              <%= will_paginate @all_feed  ,
                :class => 'pagination',          
                :previous_label => '&laquo; Previous',
                :next_label     => 'Next &raquo;',
                :renderer => 'WillPaginate::LinkRenderer' %>
              <div>
    <div class="now_loading" style="display:none;">
      <img src="http://www.tkk7.com/images/loading.gif"></img>
    </div>
    <script>
      $.bottomlessPagination({objName:'更多更新', callback:function(){
          //highlight current row
          //  $("div.results").effect("highlight", {}, 3000);
        }});
    </script>



    Action:
    def index

        if request.xhr?    
            sleep(1) # make request a little bit slower to see loader :-)   
              render :partial => 'activity' , :collection => @all_feed
    end


    partial:_activity.html.erb
    partial 里輸出數據即可


    主要的注意點就是注意對應class 不要寫錯了,同樣,你也可以把class 換位id做,jquery取id就這樣: $("#ID")

    上面js文件下載:
    http://www.dbank.com/download.action?k=3094283bf64e445f9530ac0554ebc9ce

    ref:
    http://github.com/davidwparker/jquery-bottomless-pagination




    fl1429 2009-09-25 16:50 發表評論
    ]]>
    Rails Jquery scrolling pagenationhttp://www.tkk7.com/fl1429/archive/2009/09/08/294299.htmlfl1429fl1429Tue, 08 Sep 2009 06:29:00 GMThttp://www.tkk7.com/fl1429/archive/2009/09/08/294299.htmlhttp://www.tkk7.com/fl1429/comments/294299.htmlhttp://www.tkk7.com/fl1429/archive/2009/09/08/294299.html#Feedback0http://www.tkk7.com/fl1429/comments/commentRss/294299.htmlhttp://www.tkk7.com/fl1429/services/trackbacks/294299.htmlruby 1.8.7 + Rails 2.1.0 + ubuntu 8.1.0

    效果:
    http://www.dzone.com/links/index.html
    http://flexidev.co.za/projects/jqpageflow/
    http://paperc.de/documents

    像上面的三個網站 的分頁效果 就是 scrolling pagination , 或者 叫 pageless pagination , endless pagination 用這些作為關鍵字, 都會搜到很多的demo, 這里我介紹 一種 demo,開發 環境 是 rails ,of course , 你也可以在其他的平臺使用。。

    最用 一直在用各種 分頁的效果,一般都是 ajax的, 例如前面 有介紹了 prototype pagenation like twitter more button, 還有 jquery ajax pagenation,這里又是 jquery scrolling pagination.....

    Demo:

    依賴庫:
    will_paginate 插件
    jquery.js
    jquery.pageless.js

    請到 下面的 那個 ref link 里下

    Action:

     def show
        @client_info = ClientInfo.find(params[:id])
        @comments = @client_info.comments.paginate(:per_page => 5 , :page => params[:page])

        if request.xhr?
          sleep(2) # make request a little bit slower to see loader :-)
          render :partial => 'comment' , :collection => @comments #返回 數據的partial
        end
    end


    解釋 : server 端

    helper method :

      # scrolling paginate like greader
      def pageless(total_pages, url=nil)
        opts = {
          :totalPages => total_pages,
          :url        => url
          #:loaderMsg  => '加載中...'
        }
        javascript_tag("$('#ajaxcomments').pageless(#{opts.to_json});")
      end


    解釋; 封裝了一個 pageless 方法,即實現 scrolling load 的的方法

    view: show.html.erb

    ..............
     <%= render :partial => 'wall' %>
    .........................


    解釋 : 前端 view


    partial : _wall.html.erb

      <div class="wall" id ="ajaxcomments">
        <%- unless @client_info.comments.empty? -%>
          <%= render :partial => 'comment', :collection => @comments %>
        <%- end -%>
        <%= will_paginate @comments  ,
          :class => 'pagination',
          :previous_label => '&laquo; Previous',
          :next_label     => 'Next &raquo;',
          :renderer => 'WillPaginate::LinkRenderer' %> <%#= pageless must use will_paginate default style %>
        <%= pageless(@comments.total_pages, client_info_path(@client_info))  %>
      </div>

    解釋 : 注意這里需要 定義 一個 id, 還有 就是 will_paginate 里的那些 參數 可以 不要 的,這里我加的,是因為 我的 enviroment.rb 中 加了 will_paginate 的 配置,如果 你沒有的話, 可以去掉的
    partial : _comment.html.erb
    ..............
    <%= display comment.body %>
    .........................

    解釋 : 顯示的 內容

    ref :
    http://github.com/jney/jquery.pageless/tree/master




    fl1429 2009-09-08 14:29 發表評論
    ]]>
    rails jquery autocompletehttp://www.tkk7.com/fl1429/archive/2009/09/04/293880.htmlfl1429fl1429Fri, 04 Sep 2009 06:40:00 GMThttp://www.tkk7.com/fl1429/archive/2009/09/04/293880.htmlhttp://www.tkk7.com/fl1429/comments/293880.htmlhttp://www.tkk7.com/fl1429/archive/2009/09/04/293880.html#Feedback0http://www.tkk7.com/fl1429/comments/commentRss/293880.htmlhttp://www.tkk7.com/fl1429/services/trackbacks/293880.html

    記得以前文章寫過 rails autocomplete 插件的使用方法, 那個是基于 prototype 的, 平時Jquery用的最多。。所以必須用jquery 實現 , 這樣的 demo 網上太多。。。。下面介紹在rails 中的一種solution

    需要的:
    jquery.js
    jquery.complete.js
    jquery.autocomplete.css

    demo :

    View:

    <script>
      $(document).ready(function() {
        $("#recipient").autocomplete("/myaccount/res_message", {
          delay:10,
          minChar: 1,
          multiple: true,
          parse: function(data) {   
            return $.map(eval(data), function(item) {
              return {       
                data: item,
                value: item.name,
                result: item.name
              }
            });
          },
          formatItem: function(item) {
            return item.show;
          }
        }).result(function(e, item)
        {       
          $("#recipient").val(item.name);
        });
      });
    </script>
    <p><%= text_field_tag :recipient, :id => 'recipient' %></p>


    解釋:
    #recipient 是對應的 id
    /myaccount/res_message 對應請求的 url
    item是參數
    name 和 show 是 返回的變量

    action:
      def res_message

        key = params[:q] if params[:q]
        @result = ClientInfo.get_login_name(key, '' , 'key')
       
        respond_to do |format|
          format.js # default : res_message.js.erb
        end
      end


    解釋 params[:q]  q 是默認向后臺發送的關鍵字查詢 參數, 并且默認的limit 是10 條數據

    view:res_message.js.erb

    <% if @result -%>
    <% i=0 %>[
      <% for result in @result %>
         <% if i==0 %>
        {name:"<%= result.login_name %>",show:"<%= result.login_name + " " %>" + "<%= result.sure_name.nil? ? " " : result.sure_name + " " %>"}
        <% else %>
          ,{name:"<%= result.login_name %>",show:"<%= result.login_name + " " %>" + "<%= result.sure_name.nil? ? " " : result.sure_name + " " %>"}
        <% end %>
          <% i+=1 -%>
      <% end -%>]
    <% end -%>

    解釋: 該view 是返回的數據,返回的是一個JSON數組

    具體詳細的可以參考:
    http://docs.jquery.com/Plugins/Autocomplete
    http://view.jquery.com/trunk/plugins/autocomplete/demo/


     



    fl1429 2009-09-04 14:40 發表評論
    ]]>
    Rails will_paginate ajax pagination with jqueryhttp://www.tkk7.com/fl1429/archive/2009/08/25/292522.htmlfl1429fl1429Tue, 25 Aug 2009 07:28:00 GMThttp://www.tkk7.com/fl1429/archive/2009/08/25/292522.htmlhttp://www.tkk7.com/fl1429/comments/292522.htmlhttp://www.tkk7.com/fl1429/archive/2009/08/25/292522.html#Feedback0http://www.tkk7.com/fl1429/comments/commentRss/292522.htmlhttp://www.tkk7.com/fl1429/services/trackbacks/292522.html
    效果預覽:


    一般 我們 在rails 中 分頁 will_paginate 是必不可少的插件,但是 一般都是基于 prototype 的,例如 ajax 式的分頁, 通過 RemoteLinkRenderer改變 css 樣式等等,都是 基于prototype 的,但是 prototype 和 Jquery 在項目中 經常遇到conflict ,這個 很 讓人 頭疼,rails 封裝好的ajax方法,好多 都因為 jquery 不能用,jquery 那么 好 前端 用戶體驗,又因為 prototype 出現 conflict , 哎 為什么 相互殘殺 呢。。。。。

    上面實現的核心思想 是 前端 通過 jquery的 異步調用數據, 后臺 rails 通過 respond_to fotmat.js 的方式 給予 返回數據。。。

    Demo:

    layout 中導入:
        <%= stylesheet_link_tag 'pagination' -%>
        <%= javascript_include_tag 'jquery' %>

    pagination 是改變分頁的樣式


    Action:

      def index
        @products = Product.paginate(:per_page => 10, :page => params[:page])
        respond_to do |format|
          format.html                        #default : index.html.erb
          format.js {:layout => false} # default : index.js.erb
        end
      end


    View:

    index.html.erb

    <div id="product">
      <%= render :partial => 'products' %>
    </div>

    index.js.erb

    $("#product").html("<%= escape_javascript(render :partial => "products") %>");

    escape_javascript 是轉義的意思 和 <%=h %> 這里的 h 差不多

    partial :
    _products.html.erb

    <script>

    $(function() {
      $(".apple_pagination a").live("click", function() {
        $(".apple_pagination").html("Page is loading...");
        $.get(this.href, null, null, "script");
    /* alert(this.href); */
        return false;
      });
    });

    </script>

    <%= will_paginate @products , :class => 'apple_pagination' ,:previous_label => '<<上一頁', :next_label => '下一頁>>'   :renderer  => 'WillPaginate::LinkRenderer' %>

    <% for product in @products  %>
      <div class="product">
        <h3>
          <%= link_to h(product.name), product %>
          <%= number_to_currency(product.price) %>
        </h3>
      </div>
    <% end %>


    上面的 $(".apple_pagination a")  即是 will_paginate 的 :class ,:renderer 使用的是will_paginate 的default 的,如果 enviroment.rb 中配置了will_paginate的樣式,這里不寫 :renderer 會出錯!,具體默認的參數 可以查看 will_paginate 下的 view_helpers.rb

    全部 源碼 下載:
    http://www.uushare.com/user/fl1429/file/1941241

    配置方法:
    1,進入工程, rake setup
    2,ruby script/server
    3,okay 成功 了。。。。

    補充 : 如果 一個 頁面 有兩處需要 分頁,那么 will_paginate 默認 情況下 是同時翻頁的。。那么 如何 避免呢。。只需要 給各自的 will_paginate 指定 不同的 class 即可  例如

    will_paginate :

    <%= will_paginate collection ,
      :class => "apple_paginate my_paginate",
      :previous_label => '<<上一頁',
      :next_label => '下一頁>>' ,
      :renderer  => 'WillPaginate::LinkRenderer'  %>

    apple_paginate 是 分頁的真正的 css,my_paginate 是為了 區別 不同區的 分頁 而加的


    jquery script :
      jQuery(function() {
        jQuery(".my_paginate a").live("click", function() { 
          jQuery(".my_paginate").html("正在加載...");
          jQuery.get(this.href, {flag : "my" }, null, 'script');
          return false;
        });
      });

    注意 jquery get 方法的 四個參數 的 意義

    ref:
    http://railscasts.com/episodes/174-pagination-with-ajax
    http://soylentfoo.jnewland.com/articles/2007/09/17/resource_this-dry-rails-resource-controllers
    http://book.csdn.net/bookfiles/375/10037514155.shtml
    http://stackoverflow.com/questions/1268383/format-js-with-rails





    fl1429 2009-08-25 15:28 發表評論
    ]]>