() | | browser.versions.android () | | | browser.versions.iPhone () | | Browser.versions.iPad ()) {Alert (' mobile side ');}Before I used a detection client library feel very good, also recommended to everyone called device.js, we can googel or BaiduGitHub Warehouse Address: Https://github.com/matthewhudson/device.jsGetboundingclientrect () Get element positionIt returns an object that contains left, right, top, bottom four propertiesvar mydiv = document.getElementById (' mydiv ');var x = Mydiv
Scroll smoothly to the top of the pageHere's one of the most common implementations of jquery: Click a link to scroll smoothly to the top of the page. There's nothing new to say, but almost every developer can use it.$ ("a[href= ' #top ']"). Click (function() { $ ("HTML, Body"). Animate ({scrolltop:0}, "slow"); returnfalse; Replace HTML tagsjquery can be very easy to implement HTML tag substitution, which will bring us more new possibilities.$ (' Li '). ReplaceWith (function() { r
Automatically create catalogs (multilevel)
Calling the Sheljsl module is much simpler than using recursive creation
const=require('shelljs')const=require('fs')if (!fs.existsSync{ shell.mkdir('-p', dir)}Ejs use of custom functionsVersion: 2.6.1Installation:npm install ejsUsing a custom function in a template to process the demo of the dataConstEjs= require(' Ejs ')Ejs.delimiter = '%'//The Custom function returns the first-letter uppercase stringConstDef_func={ Capitalize(str){
set the Data-theme property to Z, for example:6. Apply Custom FontsWhen you build a web App with jquery Mobile, you want to use some special fonts, and you'll find that customizing fonts with @font-face is a pretty satisfying approach.7. Create a button with no text and only picturesSometimes, you might want to use a button with no text content that still has a button feature. To hide text on a button, set data-iconpos= "Notext", for example:8. Open a hyperlink without using the Ajax page trans
This article provides a detailed analysis of PHP security detection code snippets. For more information, see
The code is as follows:
/**
* Html conversion output (only Escape '"to keep Html running properly)* @ Param $ param
* @ Return string
*/
Function htmlEscape ($ param ){
Return trim (htmlspecialchars ($ param, ENT_QUOTES ));
}
/**
* Array or not (check whether there are values in the array at the same time)* @ Param $ params
* @ Return boo
These code snippets or programs, look smart, or quite practical, worth collecting
Reply content:Write code, do not test, do not need Beethoven (back multi-points) that year is to not use the endorsement of the computer Ah! (Serious face
This knowledge, is in the process of playing deeply engraved in the mind. Just like a little bit of gas is a small attack, shipped three is the air cannon, deep engraved in the mind AH (what I'm talking about
That
The 10 useful code snippets that C # programmers often use are described in detail:
1 read the operating system and CLR version
OperatingSystem os = System.Environment.OSVersion; Console.WriteLine ("Platform: {0}", Os. Platform); Console.WriteLine ("Service Pack: {0}", Os. ServicePack); Console.WriteLine ("Version: {0}", Os. Version); Console.WriteLine ("VersionString: {0}", Os. VersionString); Console.WriteLine ("CLR Version: {0}", System.Environment
Super practical seven PHP code snippets to share. 1. super simple page cache if your project is not based on the CMS system or framework, it will be very practical to build a simple cache system. The following code is very simple,
1. super simple page cacheIf your project is not based on a CMS system or framework, creating a simple cache system will be very practical. The following code is very simple, but it can solve problems for small websites.
T
Common strings in php are used to process code snippets. The code for removing the HTML tag copy is as follows: $ textstrip_tags ($ input,); the above function mainly uses strip_tags. for detailed instructions, see. Returns to remove the HTML tag between $ start and $ end.
The code is as follows:
$ Text = strip_tags ($ input ,"");
The above function mainly uses strip_tags. for detailed instructions, see.
Returns the text between $ start and $ end.
Summarize the JS code snippets and browser models related to AJAX in. net development, making full use of free controls is good, but if you cannot modify the controls to meet your needs, you need to use the JS method, the premise is to study the method attributes of various objects in the browser model. It is especially cool to be familiar with CSS + HTML. JS language itself does not have high requirements.
1. tips for dynamically deleting the conten
program, it is not convenient. Please refer to the example below.Class AutoStopwatch:System.Diagnostics.Stopwatch, idisposable{public autostopwatch () { Start (); } public void Dispose () { Stop (); Console.WriteLine ("Elapsed: {0}", this. Elapsed);} }With the using syntax, as shown in the following code, you can check the run time of a piece of code and print it on the console.using (new Autostopwatch ()) { Decimal total2 = 0; int limit2 = 1000000; for (
'). Load (function () {Alert (' This Image has Been Loaded ');});47. How to use jquery to specify namespaces for events:Events can bind namespaces like this$ (' input '). Bind (' Blur.validation ', function (e) {// ...});The data method also accepts namespaces$ (' input '). Data (' Validation.isvalid ', true);48. How to check if cookies are enabledvar dt = new Date ();Dt.setseconds (Dt.getseconds () + 60);Document.cookie = "cookietest=1; Expires= "+ dt.togmtstring ();var cookiesenabled = docume
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.