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