Wednesday, June 19, 2013

Remove Weekends From jQuery UI Datepicker

In this post, find jQuery code to remove weekends rather than disabling them from jQuery UI Datepicker. This is quite useful when you don't want to allow users to select weekends.


To disable weekends, all you need to do is to override ".ui-datepicker-week-end" css class and set display to none.
.ui-datepicker-week-end {
    display:none
}
Related Post:

There is a small problem which you may face when you override this css class. Which is that it applies to all the datepickers present on the page. If you want the same behavior for all the datepickers then you don't have to worry but when this behavior is required only for specific datepicker, then above solution will not work.

To remove weekends for specific datepicker, you need to hide the ".ui-datepicker-week-end" on focus and blur event.
$('#txtNoWeekend').datepicker();

$("#txtNoWeekend").focus(function () {
   $(".ui-datepicker-week-end").hide();
});

$("#txtNoWeekend").blur(function () {
   $(".ui-datepicker-week-end").hide();
});
Feel free to contact me for any help related to jQuery, I will gladly help you.

Tuesday, June 18, 2013

jQuery to redirect page after specific time interval

You must have come across any website which uses a webpage with some annoying advertisement and a message that says "You will be redirected to actual page after X seconds". This can be easily implemented with jQuery. In this post, find jQuery code to redirect user to another webpage after specific time interval or few seconds.

The below jQuery code uses JavaScript setInterval which executes a function, over and over again, at specified time intervals. So all is required is to set the setInterval as 1 second and then minus the counter from actual time interval. When it reach to zero second , simply redirect to specific path.

Related Post:
$(document).ready(function () {
   window.setInterval(function () {
      var iTimeRemaining = $("#spnSeconds").html();
      iTimeRemaining = eval(iTimeRemaining);
      if (iTimeRemaining == 0) {
         window.location.href = "http://jquerybyexample.blogspot.com/";
      }
      else {
         $("#spnSeconds").html(iTimeRemaining - 1);
      }
  }, 1000);
});
Feel free to contact me for any help related to jQuery, I will gladly help you.

Friday, June 14, 2013

Create Collage using jQuery

In this post, find out how to create a collage using a jQuery plugin called "CollagePlus". This plugin for jQuery will arrange your images to fit exactly within a container. You can define the padding between images, give the images css borders and define a target row height.



How to use it?
// example HTML image gallery
<div class="Collage">
   <img src="example1.jpg" />
   <img src="example2.jpg" />
   <img src="example3.jpg" />
</div>

//Call jQuery plugin function to create collage.
$('.Collage').collagePlus();
CollagePlus relies on all images being loaded before it can calculate the layout. It does not run off image sizes specified in the DOM.
Feel free to contact me for any help related to jQuery, I will gladly help you.

Thursday, June 13, 2013

Best jQuery Rating Plugins

Find collection of 8 Free & Best jQuery Rating Plugins. These plugins are easy to use and can be implemented in your website for any kind of Poll, Vote or to include ratings. Enjoy!!!!

Related Post:

jQuery Raty



jQuery Bar Rating Plugin



jQuery quickie



jQuery SimpleRating plugin



jQuery Star Rating Plugin



RateIt



jRating



jQuery Rater


Feel free to contact me for any help related to jQuery, I will gladly help you.

Check for '#' hash in URL using jQuery

In this short post, find jQuery code to check if URL contains "#" (hash) or not. This can be checked via location.hash property provided by JavaScript and same can be used in jQuery.
$(document).ready(function(){
    if(window.location.hash) {
      // # exists in URL
    } 
    else {
       // No # in URL.
    }
});
Feel free to contact me for any help related to jQuery, I will gladly help you.