Friday, January 17, 2014

Fibonacci sequence in JavaScript

This is a short post showing you how you might create a function in JavaScript which will return and array of Fibonacci numbers, starting at 0 up to a specified point.

Little tasks like this are fun and can keep one busy or a few minutes or hours and teach more about a language in the process.

There is 2 examples in this post, the first using a for loop and the second using recursion.

Saturday, January 26, 2013

When to use RenderPartial, Partial, RenderAction or Action in MVC

In ASP.NET MVC you can render data from partial views by using RenderPartial, Partial, RenderAction or Action. At times this can be confusing. In this article we look at the different methods in a little more depth to try and clarify why and when you would use which method.

Tuesday, January 22, 2013

Migrating to jQuery 1.9


jQuery 1.9 was released on the 15th of January 2013 and along with it a few changes.
Migrating to 1.9 is different than with previous versions due to the removal of deprecated features, making the new release smaller and cleaner.

So how do you go about migrating to jQuery 1.9?

Wednesday, November 28, 2012

jQuery: Retrieving thin, medium or thick border settings

This post is about extracting the border-width of an element when it is set to thin, medium or thick using jQuery.

jQuery has several methods available to us to retrieve the width of an element such as width(), innerWidth(), outerWidth() and outerWidth(true).

Even if this post only focuses on the width, the same applies to the height as well off course.

For a more detailed look into each of those method see my previous post on jQuery: height, width, inner and outer

Content


Tuesday, September 25, 2012

jQuery CDN Fallback - What if the CDN is down?

In your website you are using a reference to a jQuery library from a popular content delivery network (CDN).

As you know, one of the benefits of using a CDN is that users visiting your page may not have to download the jQuery file every time they visit your site.
Other benefits are that they have high availability and perform very well.
However, on the rare occasion a CDN could be down or the provider could have general connectivity problems. Providers such as Google or Microsoft are not impervious to those problems, they can limit the effects but still, you can end up in a situation in which the CDN you are pointing to is unable to supply you with the file.

Thursday, September 13, 2012

Does it matter which CDN you use for jQuery?

There is a very interesting article regarding the quality of Content Delivery Networks (CDN) of different providers published on royal.pingdom.com.

Does it really matter which CDN you use? We know that if we pick the CDN which is more popular that the chance a user has to download the file when visiting your site is slimmer.

You might be a little surprised to learn that there is more to it than just popularity.

Pingdom has performed tests on the 3 most commonly used free CDN hosts; Google, Microsoft and Media Temple. Media Temple being the official host of jQuery.

To evaluate the networks, Pingdom performed tests from multiple locations across Europe and North America, once per minute, 27/7 for 30 days.

Wednesday, September 12, 2012

jQuery implementing show more - show less

This is a small tutorial on how to create a show-more and show-less feature.

In this example we will be using jQuery's toggleClass() to toggle between class objects. We will also be using jQuery UI's switchClass() for adding animation when toggling classes.

Content


jQuery 2.0 - Bye Bye IE6, 7 and 8 support

With jQuery 1.8 only recently released at the end of August you might be wondering what is so interesting about jQuery 2.0, given 1.9 is planned to only be released early 2013.

According to the jQuery blog it currently is planned for jQuery 1.9 to be released some time early 2013 as a continuation to 1.8.

However, there will also be the jQuery 2.0 release shortly after jQuery 1.9.

The difference between 1.9 and 2.0 is that jQuery 2.0 will no longer support IE6, IE7 and IE8.

Tuesday, September 11, 2012

jQuery: Event handlers

They are several methods for attaching and removing event handlers within jQuery.

As of today the latest version is 1.8.2 and we have available to us:
  • shortcuts, such as click(), blur(), change() and others
  • bind() and unbind() - added in version 1.0
  • delegate() and undelegate() - added in version 1.4.2
  • on() and off() - added in version 1.7
  • one() - added in version 1.1

As of jQuery 1.7 on() and off() are the preferred methods for attaching and removing event handlers, replacing all other methods.

Content