常用jQuery代碼分享,jquery代碼

來源:互聯網
上載者:User

常用jQuery代碼分享,jquery代碼

1.查看瀏覽器資訊

navigator.userAgent

檢索瀏覽器資訊包括哪些字元

例如:

if (navigator.userAgent.toLowerCase().indexOf("htc") >= 0) {        $("#GuanKa .page_content").css("transform", "scale(0.92)");        $(".gaunka_pic").css("top", "-100px");        $(".ertongji_btn").css("top", "570px");      }

 2.給連結設定參數,再根據url參數做相應的事情

//使用者當天還沒上傳圖片     $(".Js_uplaod_bnt").click(function () {      if ($(this).attr("myid") == "1") {        SiteFunc.Ga('選擇騎騎寶');      }      else if ($(this).attr("myid") == "2") {        SiteFunc.Ga('選擇睡睡寶');      }      else if ($(this).attr("myid") == "3") {        SiteFunc.Ga('選擇踢踢寶');      }      else if ($(this).attr("myid") == "4") {        SiteFunc.Ga('選擇爬爬寶');      }      else if ($(this).attr("myid") == "5") {        SiteFunc.Ga('選擇學習寶');      }      else if ($(this).attr("myid") == "6") {        SiteFunc.Ga('選擇走走寶');      }      window.location.href = "Upload.aspx?BabyPostureID=" + $(this).attr("myid");    });//點擊上傳Icon圖片的顯示  var CurBabyPostureID = Cmn.Func.GetParamFromUrl("BabyPostureID");  $(".Js_photo_icon_upimg img").attr("src", "images/result/photo_icon" + CurBabyPostureID + ".png");

3.手機端長按觸發事件

//某一元素長按了2秒就跳轉到一個頁面var _timeout = null;    //長按二維碼跳轉到辦卡也    $(".Js_LongPressToCard").on("touchstart",function () {      window.clearTimeout(_timeout);      _timeout = setTimeout(function () {        window.location.href = "https://mbank.spdbccc.com.cn/creditcard/indexActivity.htm?data=000501";      }, 2000);    });    $(".Js_LongPressToCard").on("touchend", function () {      window.clearTimeout(_timeout);    });

以上所述就是本文的全部內容了,希望大家能夠喜歡。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.