Common jQuery code sharing and jquery code
1. View browser Information
navigator.userAgent
Search for characters in browser Information
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 perform relevant operations based on the url parameters.
// The user has not uploaded the image that day $ (". js_uplaod_bnt "). click (function () {if ($ (this ). attr ("myid") = "1") {SiteFunc. ga ('select riding trease');} else if ($ (this ). attr ("myid") = "2") {SiteFunc. ga ('select sleep trease');} else if ($ (this ). attr ("myid") = "3") {SiteFunc. ga ('select kick papp');} else if ($ (this ). attr ("myid") = "4") {SiteFunc. ga ('select crawling trease');} else if ($ (this ). attr ("myid") = "5") {SiteFunc. ga ('select learning trease');} else if ($ (this ). attr ("myid") = "6") {SiteFunc. Ga ('select walking trease');} window. location. href = "Upload. aspx? BabyPostureID = "+ $ (this ). attr ("myid") ;}); // click the Icon to upload the image. func. getParamFromUrl ("BabyPostureID"); $ (". js_photo_icon_upimg img "). attr ("src", "images/result/photo_icon" + CurBabyPostureID + ". png ");
3. Mobile phone terminal long press trigger event
// When an element is pressed for 2 seconds, it jumps to a page var _ timeout = null. // You can also press the QR code to jump to the page $ (". 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 );});
The above is all the content of this article. I hope you will like it.