Thursday, February 6, 2014

To make an square menu

I was looking for a menu which would look different than other menu and will stand out among the crowd and I stumbled upon this menu.

Please follow the link to watch the menu
http://www.onextrapixel.com/examples/square-like-3d-animated-menu-gallery/index4.html

Friday, January 31, 2014

New Function disableToggle to toggle disable on and off

New Function disableToggle to toggle disable on and off similar to slideToggle



/*********************
Function:disableToggle
author:Mukesh
License: Void of any license
**********************/
$.fn.disableToggle = function() {
   if(($(this).attr("disabled")=="disabled") ($(this).attr("disabled")==true))
   {
      $(this).removeAttr("disabled");
   }
   else
   {
      $(this).attr("disabled","disabled");
   }
};

This function can be called as

$("#element-id").disableToggle();

where element_id is the id of the element.
For e.g.,

$("#edit-name").disableToggle();

Testing whether date entered into a text box is a date of format 'YYYY-mm-dd'

Testing whether date entered into a text box is a date of format 'YYYY-mm-dd'


var to_date = $("#edit-to-date").val();
if(/[0-9]{4}-[0-9]{2}-[0-9]{2}/.test(to_date))
{
alert("hello");
}


test() returns true if the date matches the format. If it doesn't match the date it returns false.

How to create a circular date holder for your blog posts

Using animate function in jquery to reduce it to zero and back


Declare this in your header or in your body for initilialising your div

<style>
div.solution{
width:400px;
}
</style>


declare the div within the body

<div class="solution"> abracadabra.....poof poof</div>


use this line to slowly reduce the width of the div to 0px
$("div.solution").animate({width:"0px"},500);

use this line to slowly increase the width of the div to 400px
$("div.solution").animate({width:"400px"},800);

The last parameter denotes the time to run the function for....