移動端網站開發總結2

來源:互聯網
上載者:User

標籤:style   blog   io   ar   color   os   sp   on   div   

這段時間一直在做移動端的網站,順便寫一點總結吧,隨便寫的,想到什麼寫什麼,所有若有幸被各位所看到,可以無視哈。。。。

1.

1 $(document).bind("click",function(e){ 2         var target = $(e.target); 3         if(target.closest(".pop").length == 0){ 4              $(".pop").hide(); 5         } 6     }) 

這段代碼,是在做右上方菜單時候用到的,  意思是除了“.pop”元素塊之外的文檔任何地方點擊一下“.pop”隱藏掉、、、

1 target.closest(".pop").length == 0

這段代碼可以說是這個小功能的中最難懂的一段代碼,target  是目標對象,詳細解釋:

e.target的含義$(function(){    $("li:has(ul)").click(function(e){        if(this==e.target){            $(this).children().toggle();            $(this).css("list-style-image",($(this).children().is(":hidden")?"url(plus.gif)":"url(minus.gif)"))        }        return false;    //避免不必要的事件混繞    }).css("cursor","pointer").click();    //載入時觸發點擊事件       //對於沒有子項的菜單,統一設定    $("li:not(:has(ul))").css({        "cursor":"default",        "list-style-image":"none"    });});===========================具體問題具體分析;當前目標在event事件中代表點擊對象;loader事件:載入對象;e只是參數,任意取值;對應即可;e.target 是目標對象,e.event是目標所發生的事件。

 

2.文字溢出部分隱藏並添加省略符號: overflow:hidden;white-space: nowrap;text-overflow: ellipsis;

移動端網站開發總結2

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.