This article mainly introduces 12 practical jQuery code snippets, this article provides some useful code snippets, such as opening links in a new window, setting high columns, pre-loading images with jQuery, right-clicking disabled, and setting timers, for more information, see jQuery, an excellent JavaScript library. It is well known among WEB developers and WEB designers. It helps WEB designers develop many creative and beautiful WEB pages.
This article mainly shares 12 useful jQuery techniques. The specific content is as follows:
Below are some tips I have collected. These tips will help you improve the creativity and functionality of your website layout and application.
1. Open the link in a new window
With this code, When you click a hypertext link, it will be opened in a new window, providing a better user experience:
$(document).ready(function() { //select all anchor tags that have http in the href //and apply the target=_blank $("a[href^='http']").attr('target','_blank');});
Ii. Set the timer
$(document).ready(function() { window.setTimeout(function() { // some code }, 500);});
3. Set high Columns
Use the following code to make each column of Your webpage application have the same height:
First Line
Second Line
Third Line
Column Two