Quantcast
Channel: jQuery By Example
Viewing all 122 articles
Browse latest View live

Converting Your Scripts Into a jQuery Plugin

$
0
0
We feature a lot of plugins on this site, so chances are if you're looking for a particular type of plugin, you'll be able to find that here. Just in case, the following is some code that will help you convert your jQuery scripts into a plugin that can be used by other developers on other sites and projects. If you spend a lot of time writing a particular script to create a functionality, it's definitely worth it to convert that code into a plugin, either for your own future use, for the future use of others, or both.

The basic code to create a plugin is actually very straightforward. Really, all you have to do is create a $.fn object and extend it with your own custom function. Check out the code below:

(function($){ $.fn.yourCustomPluginName = function(){ // insert your script herereturnthis; }; })(jQuery);

As you can see, it only takes a few extra lines of code to create your own unique jQuery plugin. When converting your own code into a plugin, make sure your code is clean, organized, and well documented (especially if you intend to make it available for the use of other developers).

Quick Summary of What's new in jQuery 3.0

$
0
0

jQuery 3.0 is the newest version of jQuery and it’s already out. There are many new features, bug fixes and deprecations of old methods. In this post, find a quick and short summary of some of the newest features and bug fixes.

  • For loop syntax changed
    jQuery 3.0 introduces new syntax for “for loop”. With this new syntax, you will get DOM element, instead of jQuery collection. So here you don’t need to use index to get the element as you are already having direct access to the element.

var $dvElements = $("div");
var i = 0;
for(var elm of $dvElements) {
   elm.addClass("dummy");
}
  • jQuery.Deferred is now Promises/A+ compatible
Deferreds have been updated for compatibility with Promises/A+ and ES2015 (a.k.a ES6) Promise. Use the new then and catch methods for Promises/A+ compliance.  
In jQuery 1.x and 2.x, an uncaught exception inside a callback function halts code execution. The thrown exception bubbles up until it is caught inside a try/catch or reaches window and triggers window.onerror. But with jQuery 3.0, any uncaught exception can be caught with in catch block. See below code.

$.ajax("/status")
   .then(function(data) {
      whoops();
   })
   .catch(function(arg) {
   });

  • New signature for jQuery.get() and jQuery.post()
Now you can set settings parameters for jQuery.get() orjQuery.post() like jQuery.ajax(). 

var settings = {
...
}

$.get(settings)
$.post(settings)

  • New method jQuery.escapeSelector()
The new jQuery.escapeSelector(selector) method takes a selector string and escapes any character that has a special meaning in a CSS selector. For example, an element on the page has an id of “abc.xyz” it cannot be selected with $("#abc.xyz") in prior version of jQuery. But with jQuery 3.0, it can be selected 
$("#" + $.escapeSelector("abc.xyz"));

  • :visible and :hidden Behavior change
jQuery 3.0 modifies the behavior of :visible and :hidden filters. Prior to jQuery 3.0, the version will not select elements with no content. For example, for following HTML

<div></div>
<br />

jQuery 1.x and 2.x will return count as 0, though these elements are visible. But with jQuery 3.0, things are changed. Elements will be considered :visible/:hidden if they have any layout boxes, or of zero width and/or height. For the above HTML, jQuery 3.0 will return count as 2.

  • Changes in .data()
There is also a change in the behavior of .data() with jQuery 3.0. It is now more align with new specification of Dataset API. Now, the property key name is transformed to camelCase. While in old version it was in lower case with dash (if exists in key name). For example,

<div data-foo-name="bar"></div>
Prior to jQuery 3, the property name is "foo-name" but with 3.0, it is "fooName". However if there are any digit present in the key name then it remain same as the previous version.
  • jQuery 3.0 runs in Strict mode
Now that most of the browsers supported by jQuery 3.0 have "use strict", jQuery is being built with this directive. Your code is not required to run in Strict Mode, so most existing code should not require any changes.

  • Cross-domain script requests must be declared
When making a request via jQuery.ajax() or jQuery.get() for a script outside your domain, you must now explicitly specify dataType: "script" in the options. This ensures the possibility of an attack where the remote site delivers non-script content but later decides to serve a script that has malicious intent.

  • width() and height()
jQuery 3.0 now returns decimal values for .width() and .height() methods. In previous version of jQuery, they return nearest value but that is in integer. For following HTML,

<div style="width:100px;">
  <div id="dvFirst">Some text..</div>
  <div id="dvSecond">Some text..</div>
  <div id="dvThird">Some text..</div>
</div>
</pre>
And below jQuery code,
<pre class="brush:javascript">
  $('#dvFirst').width();

will return 33 but with jQuery 3.0, returned value is 33.3333333. So you get more accurate results.
  • unwrap() Method
unwrap() method allows you to remove the parents of the matched elements from the DOM. But there was no way to unwrap based on certain conditions as it did not accept parameters earlier. With jQuery 3.0, you can pass a selector to it.
  • RequestAnimationFrame() for animation
jQuery 3.0 will use requestAnimationFrame() on platforms/browser which supports this property. This will ensure smooth animation and consume less CPU power.

  • load(), unload() AND error() methods are removed
jQuery 3.0 removes all above deprecated method. These methods were deprecated in jQuery 1.8 but still available to use. But now, they are removed.

  • bind(), unbind(), delegate() AND undelegate() are deprecated
jQuery 1.7 introduced .on() method to replace .bind(), .live() and .delegate(). And they encourage developers to use .on() method for better handling of binding the events to dynamic objects. But these methods are still available to use. But with jQuery 3.0, these methods are deprecated with the intention of removing them in future.

Create a Simple Notification Bar on Top of Page Using jQuery

$
0
0
Notification bars on top of a page is a feature to display important messages to catch a website visitor’s attention. There are plenty of plugins available to display notification bars, but it’s not advisable to use a jQuery plugins if the same task can be completed via simple jQuery code, as adding a plugin will consume bandwidth. So in this post, let’s see how to create notification bar on top of the page using custom jQuery.


The notification bar will have a close button along with sample message. Clicking on close button will hide the notification bar. And there also exists another link to display the notification bar again if it’s hidden. Below is the HTML used for creating navigation bar along with all required buttons.

<div id="dvNotify" class="notification">
  <label>Sample notification message.</label>
  <a href="#" id="btnClose">[x]</a>
</div>
<div style="text-align:center;">
  <a href="#" id="btnShow">Show Notification</a>
</div>

As we need to display the notification bar on top of the page with absolute positioning, here is the CSS used for the same.

.notification {
  background-color: lightYellow;
  color: red;
  font-size: 16pt;
  position: absolute;
  width: 100%;
  top: 0px;
  left: 0px;
  text-align: center;
  padding: 10px;
}

And finally jQuery code to show and hide the notification bar.

$(function() {
  $("#btnClose").click(function(evt) {
    $("#dvNotify").slideUp('slow');
  });
  $("#btnShow").click(function(evt) {
    $("#dvNotify").slideDown('slow');
  });
})

And here is the demo.

<script async src="//jsfiddle.net/ftu67cff/embed/result/dark/"></script>

When page is loaded, the notification bar will always be displayed. If you want to hide it on page load and want to show it on button click, then you need to add following line to jQuery code.

$(function() {
  $("#dvNotify").hide();


Change Page Title on Focus Out Using jQuery

$
0
0
It is a good idea to change the page title to something catchy when the user moves to a different tab to catch his attention. This can help to get the user to come back your website. So in this post, let’s find out how to change the title of the page when user moves to different tab using jQuery.
Here is the jQuery code which will change the page title to “something of your choice” on focus out and set the original title when the focus is back on the page.

$(document).ready(function(){
var oldTitle = $(document).find("title").text();
var newTitle = "Read this...";

function setTitle(title){
  document.title = title;
}

$(window).on("focus", function(){
setTitle(oldTitle);
}).on("blur", function(){
setTitle(newTitle);
});
});

The above code does following:
  • First, it stores the original title of the page in a variable.
  • Then, it initializes another variable “newTitle” to store the new title. For the demo, it is set to “Read this…” but you are free to change.
  • Defines a setTitle function which set the title of the page.
  • And then attaches focus and a blur event to the window to change the title. When focus moves out, then sets the new title. And when focus is back on the window, sets the old stored title.



8 Handy jQuery Code Snippets For Your Next Project

$
0
0

Here are 8 handy jQuery code snippets for your next project. These jQuery code snippets are super handy and can make your life easy for handling small things efficiently. These snippets allow you to handle css, jQuery animations, deal with input boxes and calculate the page load time.
1. Remove all inline styles using jQuery
$(document).ready(function(){
   $("* [style]").removeAttr("style");
})

2. Disable jQuery animation
You can disable the jQuery animation via setting fx.off property.
$(document).ready(function() {
   jQuery.fx.off = true;
});

3. Select all readonly input type textbox
$(document).ready(function() {
  $(":input[type=text][readonly='readonly']").val("");
});

4. Disable double click event
$(document).ready(function() {
   $("*").dblclick(function(e){
     e.preventDefault();
   });
});

5. Clear textbox value using ESC key
$(document).ready(function() {
    $('input[type="text"]').keyup(function(e){
        if(e.keyCode == 27) {
            $(this).val('');
        }
    });
});

6. Load CSS files using jQuery
For if you wish to load CSS files dynamically based on certain conditions
$(document).ready(function(){
   $("head").append("<link>");
var css = $("head").children(":last");
css.attr({
    rel:  "stylesheet",
    type: "text/css",
    href: "CSS/Demo.css"
  });
});

7. Calculate page load time using jQuery
var startTime = (new Date()).getTime();
function CalculatePageLoadTime(){
   var endTime = (new Date()).getTime();
   var diff = (endTime-startTime) / 1000;
   console.log('Page load time: ' + diff + ' sec(s).');
}
window.onload = CalculatePageLoadTime;

8. Check if HTML element is empty
function isElementEmpty(elm){
    return !$.trim(elm.html())
}
if (isElementEmpty($('#element'))) {
    //do something
}

5 Best jQuery Mobile Frameworks

$
0
0
Although creating a mobile app might seem like a daunting task even for the most experienced web developers who don't have much mobile experience, the truth is that most skilled developers can probably create a mobile app fairly easily -- it's really not terribly different from creating web apps. Still, it doesn't hurt to use a mobile framework to help you along the way, especially in terms of bridging the gap between mobile and web apps. Any of the frameworks below would be a welcome addition to your mobile projects.

1. jQuery Mobile


jQuery mobile is a mobile development framework that's optimized for creating multi-platform apps.


Ratchet was originally developed by Twitter as a series of prototypes for Twitter's iPhone app. Now, it's a useful framework for building out mobile apps, and comes with some helpful UIs and JavaScript plugins to get you going.



Framework7 is an open-source mobile HTML framework for developing hybrid apps with an iOS look and feel. It's specifically meant to make the transition from developing web apps to mobile apps seamless and easy.

4. Ionic
Ionic is a lightweight and scalable framework meant to develop hybrid apps. It comes loaded with JS, Sass, and HTML input components. It also works really well with Angular.js.


Mobile Angular UI is a framework that lets you use Angular and Boostrap for mobile app development -- perfect for first time app developers looking for a way to ease into mobile.







Learn jQuery Interactively for Free

$
0
0
A lot of developers and coders probably agree that one of the best way to learn a new coding language, skill, or technique is to do so by learning and experimenting in a hands-on, interactive way. jQuery is no exception to this rule. If you're looking for free ways to get some real-world jQuery experience, check out any one of these resources, where you'll find interactive and free jQuery lessons to help take your skills to the next level!

1. Codecademy


Codecademy is a great free resource for learning jQuery. It's suitable for absolute beginners or for developers who may know a little jQuery but want to brush up on the basics. The free jQuery course has 7 lessons including a final project.



This interactive course was created by Code School and is another great way to learn jQuery for free. The lessons are extensive, offering 14 videos and 71 coding challenges, in addition to helpful and informative slides that will help guide you through each lesson.


This free online course is for absolute jQuery beginners, and will give you a great foundation for creating more interactive sites using jQuery.



Udacity is a site that offers free and paid courses in hundreds of different subjects, including computer science and web development. They offer this jQuery intro course completely for free, which will provide you with a great base of knowledge if you choose to take one of the more advanced courses to continue your learning.




7 jQuery Plugins for Form Validation

$
0
0

It's possible to write your own form validations, but with so many jQuery plugins available to do it for you, it's often a lot easier, simpler, and most importantly, quicker, to use a plugin to perform your validations. All of these plugins are lightweight, easy to use, and of course, will allow you add validations to your forms and save time when working on any of your projects.

1. jQuery Validation Plugin

This plugin can be used to add validation rules to any of your jQuery forms. It's lightweight and can be customized easily!


Parsley is a popular JavaScript form validation library that can be used to validate front-end forms easily and quickly. One of the benefits of using Parsley is that it's very UX focused and customizable, so it will seamlessly integrate with your projects.



Bootstrap Validator is a simple form validator plugin designed especially for the Bootstrap framework. If your site uses Bootstrap, this is a great option to use for form validation.

4. Smoke


Smoke is another form validation plugin that's meant to be used with Bootstrap. Some of its great features include support for Angular and Bootstrap's date-picker.



The Validatr plugin is unique in that it uses HTML5 input attributes to perform validation, which makes it super lightweight.



Validetta is a sef-proclaimed "tiny" plugin that can be used to perform client-side validations. If you're looking for a lightweight, simple jQuery plugin, this is a good option. 


The jQuery Ketchup plugin for form validation is great because it's built as a validation framework that can be completely customized to meet your needs. If you want a good jumping off point for making your own customizations and validation rules, Ketchup may be the way to go. 





5 Top jQuery Button Plugins

$
0
0
Looking for cool, different ways to style your buttons? With customizable colors, shapes, and hover effects, the styling possibilities are seemingly endless, and choosing how to design your buttons and input fields can sometimes be overwhelming. If you don't want or don't have time to deal with big styling decisions but still want your buttons to look great, check out any of these plugins below.

1. jQuery UI Button



The jQuery UI Button plugin is the official jQuery plugin to enhance the appearance of standard form elements such as buttons, and anchors. The enhancements includes options for active and hover styles as well.

2. Labelauty



Labelauty is a lightweight jQuery plugin that creates beautiful input fields such as radio buttons and checkboxes.

3. jQuery addToggle


jQuery's addToggle plugin creates a minimalist on/off switch that can be added to any of your projects. Features like color and size are easily customizable to blend in with your site's theme and design.



Checkbox-field is a unique and useful plugin that will turn your mutli-select lists into beautifully organized and styled checkbox fields. Perfect for converting older, uglier designs and functionalities into something modern, new, and user-friendly.




The Bootstrap Checkbox plugin creates checkbox fields that draw inspiration from Bootstrap's button styling. If you like the style of the Bootstrap framework but aren't using it for your projects, this plugin is a great option for achieving the Boostrap look on some of your HTML elements.

Create Blinking Text Without Using a Plugin

$
0
0


There are tons of jQuery plugins available for any kind of text animation. But the use of jQuery plugin should depend on what are you trying to achieve. One should be very careful while using any jQuery plugin as it comes with some bandwidth. Your website needs to download extra kilo bytes when it's viewed in browser and needs to load lots of plugins. Simple text effect can be easily achieved via plain jQuery code. You don’t need any jQuery plugins. In this post, lets us see how to create blink text effect with plain jQuery code.

jQuery, out of the box provides animation methods like fadeIn and fadeout. We can use these methods to create the blink effect. As blink effect involves fading in and fading out only. So let’s create a function which will create the blink effect.

function blinkText(elm){

$(elm).fadeOut('slow', function(){

$(this).fadeIn('slow', function(){

blinkText(this);

});

});

}

In the code above, first a call is made to the fadeout method, which when completed makes a call to function. And this function calls fadeIn method to fade in the text. And this method calls the blinkText method again to create an endless loop of fade out and fade in. And this results in creation of blink effect. Now all you need to do is to call this function on your DOM element.

In the following jQuery code, calls blinkText method on all DOM elements which are having blinkText CSS class.

$(document).ready(function(){

blinkText('.blinkText');

});

fadeIn and fadeout method takes milliseconds as duration. From jQuery documentation, durations are given in milliseconds, so higher values indicate slower animations, not faster ones. The strings 'fast' and 'slow' can be supplied to indicate durations of 200 and 600 milliseconds, respectively. If any other string is supplied, or if the duration parameter is omitted, the default duration of 400 milliseconds is used.

How to use jQuery to Prevent Multiple Form Submit for Efficient Forms

$
0
0
Often when a jQuery form is submitted, it can accidentally happen more than once. Depending on the server speed or the internet connection, the request to submit the form can go through slowly, which often leads to the user hitting the submit button more than once because they may think it isn't working. When this happens, the form can be submitted multiple times, which isn't a huge deal, but can definitely lead to some clogging up of your inbox.

A really good way to prevent this from happening is to use some simple jQuery code that disables the submit button after it's been submitted. The code to add this functionality to any of your projects is efficient, lightweight, and less than 15 lines.

  $('form').submit(function() {
    if(typeof jQuery.data(this, "disabledOnSubmit") == 'undefined') {
      jQuery.data(this, "disabledOnSubmit", { submited: true });
      $('input[type=submit], input[type=button]', this).each(function() {
        $(this).attr("disabled", "disabled");
      });
      return true;
    }
    else
    {
      return false;
    }
  });

When adding it to any of your projects, don't forget to add the specific form class or ID for the form you want to target if you don't want or need this snippet to apply to all the forms on your site.

Best jQuery Plugin for Falling Snow Effect

$
0
0
With winter's sudden arrival and the holidays fast approaching, you may find yourself in the market for a plugin that allows you to add a falling snow effect to any of your pages. Our falling snow plugin of choice is the Snowfall 1.6. Using this plugin, you can create a falling snow effect that covers your entire page, or just small sections of a page.


One of the great things about this plugin is how customizable it is. You can specify the size and shape of the snowflakes (you can make them really small, bigger, or even have them appear in a classic snowflake shape -- see example in image below). You can also specify the rate at which the snowflakes fall, the amount of snowflakes that appear on the screen at one time, and whether or not the snowflakes have a shadow attached to them. 


Another cool feature of this plugin is that it can also be programmed to collect snow on certain HTML elements. For example, you can have the snow particles build up on a particular div element or page section, which makes the snow effect look a lot more realistic than it might otherwise appear. You can also easily add a line of code that will stop the snow effect, in case you'd like to include a button that the user can click if they're not a fan of winter weather. 

Format Your jQuery and JavaScript With This Useful Tool

$
0
0
If you've ever worked with improperly formatted code before, you know what a total pain it can be to edit, add to, and even understand. Formatting is really important when it comes to jQuery and JavaScript. If code isn't formatted properly, there's a good chance you're going to miss some closing brackets or forgot a semi-colon or two.

So what do you do when you come across a JavaScript or jQuery file that looks a mess? You can go through it all yourself, or you can painstakingly format it by hand, OR you can use a jQuery formatter and reformat an entire file in a matter of seconds.



jsBeautifier is a free online JavaScript and jQuery formatter that will bring order and organization to your code files. It's totally customizable and gives you so many options for how exactly you'd like your scripts to be formatted. You can control anything from the number of indent spaces to whether or not you'd like the text to wrap.

Do you want to indent arrays? Do you want spaces between the "if" and the "()" in your if statements? This jQuery formatter will take care of all of that for you and more. If you're looking to make any JavaScript or jQuery code more clean and organized (or even looking to make sure your own clean code is consistent in its formatting) this is a great tool to use.

How to Get Cursor Coordinates Using jQuery

$
0
0
It's fairly easy to get the coordinates of your cursor using jQuery. While this information might not be particularly useful to a lot of developers, there are definitely occasions where the x and y coordinates of your cursor can be particularly useful.

The code snippet below shows you how to find the x and y coordinates of a cursor when it's within a particular HTML element (a box, a div...whatever you like), and then display those coordinates through an alert message. The code can be totally customized to have the coordinates instead print to the console, or to have the cursor coordinates be found within the body or the window rather than within a particular element. Use the snippet below as a jumping off point for your cursor-finding code:

$(function() {
$("#coordinates-box").click(function(e) {
  var offset = $(this).offset();
  var relativeX = (e.pageX - offset.left);
  var relativeY = (e.pageY - offset.top);
  alert("X coordinate: " + relativeX + " Y coordinate: " + relativeY);
10
});
11
});

5 of the Funniest jQuery Plugins

$
0
0
Sometimes the coolest jQuery plugins are the ones that really don’t serve a purpose at all. 

1. Bacon!



Bacon! (don’t forget the exclamation point!) exists literally to add strips of bacon to your webpages. If you ever feel like you might need to spice up a dull page or a boring block of text…why not add some bacon?




Raptorize is a jQuery plugin that, at the click of a button, will unleash a vicious raptor (complete with scary sound effects) upon your users’ browsers (or, if you really want to scare people, you have the option to allow the raptor to load and appear on a timer for your unsuspecting users).




RevRev.js is a self-proclaimed “mostly pointless jQuery plugin” that you can use to reverse the direction of some of your letters. Like they said, it’s mostly pointless, but it does make for a unique look and could maybe, possibly, potentially have some use on some site somewhere (maybe a site that sold funhouse mirrors?). You can also add random caps, random spacing, change the font-size, etc. 




This plugin will turn any HTML element into a kitten, if you want it to.





Cornify is the jQuery plugin of Lisa Frank’s dream. Basically, it adds all sort of rainbow, unicorn, glittery, happy stickers and images to your page at the click of a button. If you feel like something is missing from one of your latest projects and you can’t quite put your finger on it, have you stopped to consider that adding a glittery unicorn could do the trick? Cornify your page and see for yourself.

5 Useful jQuery Snippets

$
0
0
1. Back to Top Button

$('a.top').click(function(){
$(document.body).animate({scrollTop : 0},800);
return false;
});

This code can be used to create a smooth, simple back to top button — a trendy and functional item to have on any website. Just make sure you use this HTML code or something similar (with the a tag having a class of “top”) to create the actual button: <a class=”top” href=”#”>Back to top</a>

2. Enabling/Disabling Input Fields

$('input[type="submit"]').attr("disabled", true);
$(‘input[type="submit"]').removeAttr("disabled”);

For when you don’t want a user to be able to input to a certain field or submit a form (maybe at all, maybe until they’ve filled out some prerequisite info). The top line of code will disable an input element, and the bottom line will enable it.

3. Zebra Striping

$('li:odd').css('background', ‘#e7e7e7’);

Zebra striping is a common stylistic choice often seen in lists and tables. The code above will add zebra striping to a list.

4. Prevent Link Functionality

$(“a.disable").on("click", function(e){
  e.preventDefault();
});

The code snippet above will take away all functionality from a link. Whichever link you place in the selector will not work at all when a user clicks it. Just make sure you specify which link you want to not work, otherwise you could accidentally end up disabling all your links by mistake.

5. Toggle Classes

$(“.main”).toggleClass(“selected”);


This snippet is super useful for changing the styling, appearance, and possibly even functionality of an HTML element by adding or removing a particular class to it. Great to use as a result of a click trigger. 

Tipsy: a jQuery Plugin for Tooltips

$
0
0
Tipsy is a jQuery plugin that creates a Facebook like tooltip effect generated from an anchor tag’s title attribute. It’s easy to use, really lightweight, and super customizable.



One of the coolest things about the plugin is that it allows you to specify the so-called “center of gravity” of the tooltips, or where each individual tooltip appears in relation to its anchor tag. The default location for the tooltips to appear is centered underneath its anchor, but with the gravity parameter, you can choose from 8 other positions.



You can also apply smooth fade in and out transitions to the tooltips so that they appear upon hover after a nice transition, and you can even combine the fade and gravity features. You can also add a delay, dynamically update the tooltip text, and use tooltips on input fields. 


If you’re looking for a good tooltip plugin, this has got to be one the easiest to use and most versatile plugins that will serve that purpose, and is definitely worthy of being included in your next project. 

jQuery & JavaScript Resources: Books

$
0
0
If you’re a bookworm looking to learn JavaScript or jQuery, this list is for you. Any of these books are great resources to learn the fundamentals of both JavaScript and jQuery and will give you a great foundation to start learning both of these languages.  


This book covers a lot of material on both jQuery and JavaScript and presents a lot of its information through beautifully designed diagrams and charts. Great for absolute beginners.




This book is super affordable and provides its readers with complete understanding of JavaScript, purposely covering material that many developers have trouble understanding, and techniques that even the most accomplished JS divs tend to avoid.




At 1096 pages, this is the so-called “bible” for JavaScript developers. If you’re looking for a book book that thoroughly covers JavaScript topics and also serves as a great reference text, this  one’s a great option. 




This text isn’t for absolute beginners, but if you’re a coder who knows other OOP languages (Python, Ruby), you may find it an interesting tool to bridge the gap between one of the other  OOP languages you know and JavaScript. 





Another book that isn’t for absolute beginners, but if you’re looking to learn about the best techniques to use for how to approach the development of certain functionalities and applications. If you already have a solid JS foundation, this is a good text to use to take you to the next level. 

4 Best Tools for Validating Your jQuery Code

$
0
0
New to jQuery and looking for some help to make sure that your code is correct? Or are you a seasoned JavaScript pro who can't seem to find that one little bug in your code that seems to be messing everything up? No matter what your level of coding expertise is, chances are you're going to need to use a validator to either validate or debug your code at some point throughout the process of writing your code. Even if you're a JavaScript master, it can never hurt to check your code with a validator to make sure everything looks good and is formatted correctly. If you're looking for a good tool to perform this sort of validation on your code, check out the list of validators we've compiled below:

1. JSHint


JSHint is a simple JavaScript validator that is very user friendly. All you need to do is enter your code into the text area on the left hand side of the page, and you'll see your code report (complete with possible errors and problems in your code) on the right hand side.

2.  Esprima


Esprima is a JavaScript syntax validator that checks mostly for syntax errors and less for general problems in your code. Esprima is perfect to use when you know you've missed a semi colon or a bracket somewhere and you want to find the solution quickly.



Code Beautify is a JS validator that will detect errors and also gather information about any inputted code -- total characters, total words, total lines. A good tool to use to quickly and easily validate your JavaScript or jQuery code. 

4. JSLint


JSLint is a versatile and customizable JavaScript code validator that lets you select some options to customize the way your code is validated. You can choose some things that you'd like the validator to "tolerate," so that you don't get any unnecessary errors for things you're already aware of or not planning on fixing, and you can also select options for CouchDB or Node.js, so the validator can take into account that your JS code is using those tools. 




7 Coolest Free jQuery Plugins for 2017

$
0
0
There are so many free jQuery plugins available to use in your projects that it can be hard to stay on top of the latest and the greatest. If you're looking for some new plugins to add some freshness to your sites, take a look at the list we've curated below at some of our favorite new and innovative plugins.

1. Face Detection


This plugin features face detection technology that applies to both images and videos. Use it as is or customize it to add even more functionality.



jInvertScroll makes it super easy to turn vertical scrolling into beautiful parallax scrolling (when your page scrolls horizontally, rather than vertically). Check out the demo to see for yourself just how smooth the scroll is. 



Tabslet is a great option if you're looking to easily add some tabs to your projects. Tabs, which have become increasingly trendy in recent years, are a good way to include a lot of information or content on one page without it looking crowded or overwhelming, plus they give your site that sleek Bootstrap look. 



If you're looking for an easy, lightweight solution for adding CSS3 animations to your text, Textillate.js is probably the plugin for you. It offers dozens of different text animations (from several different directions or angles) for you to choose from.



Want your content to be neatly organized into a Pinterest-style grid? Gridify can achieve this effect for you quickly and easily. This plugin is lightweight and supports CSS3 transition animations.



The Sliphover plugin is a great, efficient way to add animated hover effects to any of your images for a sleek, modern look.



As a developer, chances are that you've probably had to deal with a pesky background image that just wasn't the right size or dimensions to actually be used as the background of the intended element. Backstretch is one possible solution to this common problem. The plugin boasts the ability to stretch any image to fit an entire page or block-level element. 







Viewing all 122 articles
Browse latest View live