Common jquery code sharing

Source: Internet
Author: User

Common jquery code sharing


1. View browser Information

Navigator.useragent



Retrieving browser information including which characters

For example:

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. Set parameters for the link, and then do the corresponding things according to the URL parameters

The user did not upload the picture      $ the same day (". JS_UPLAOD_BNT "). Click (function  ()  {      if  ($ (this). attr (" myID ")  ==  "1")  {        sitefunc.ga (' Choose to ride a Ride po ');       }      else if  ($ (this). attr ("myID")  ==   "2")  {        sitefunc.ga (' Choose Sleeping treasure ');       }      else if  ($ (this). attr ("myID")  ==  "3")  {        sitefunc.ga (' Choose kicking and Kicking po ');       }      else if  ($ (this). attr ("myID")  ==  "4")  {         sitefunc.ga (' Choose to climb the Treasure ');       }       else if  ($ (this). attr ("myID")  ==  "5") &NBsp {        sitefunc.ga (' Choose learning Treasure ');       }       else if  (This). attr ("myID")  ==  "6")  {         sitefunc.ga (' Choose to walk the treasure ');      }       window.location.href =  "Upload.aspx? Babypostureid= " + $ (This). attr (" myID ");     });//Click upload icon to display the image   var  curbabypostureid = cmn.func.getparamfromurl ("Babypostureid");   $ (". Js_photo_icon_upimg img "). attr (" src ", " Images/result/photo_icon " + curbabypostureid +   ". png");



3. Phone-side long press trigger event

An element has been pressed for 2 seconds to jump to a page var _timeout = null; Long press the QR code to jump to the office card also $ (".      Js_longpresstocard "). On (" Touchstart ", function () {window.cleartimeout (_timeout); _timeout = SetTimeout (function () {window.location.href = "https://mbank.spdbccc.com.cn/creditcard/indexActivity.h      tm?data=000501 ";    }, 2000);    }); $(".    Js_longpresstocard "). On (" Touchend ", function () {window.cleartimeout (_timeout); });



The above mentioned is the whole content of this article, I hope you can like.  

Reference Source: http://www.aichengxu.com/view/60417

Common jquery code sharing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.