Wednesday, November 4, 2009

Mutually Exclusive Checkbox with Select All in grid: jQuery

The full code: (Copy the code below into a new folder with the jquery-1.3.2.min.js file in it and run the page).

Getting a select all checkbox to work can prove to be simple in jQuery. But a select all isn't just on click of a checkbox on top of the column. It has to do a check on its siblings too. If all children are checked, the select all must also be checked.


Here I have taken a step further ahead and implemented an additional functionality, which you can find it in AJAX control – MutuallyExclusiveCheckBoxExtender.



<html>


<head>


<script type="text/javascript" language="javascript" src="jquery-1.3.2.min.js"></script>


<script type="text/javascript" language="javascript">


$(document).ready(function(){


$("#checkall0").click(function(){


$("#grdView tr").each(function(){


$(this).children(0).eq(0).children(0).attr('checked',($("#checkall0").is(':checked'))?true:false);


});


});




$("#checkall1").click(function(){


$("#grdView tr").each(function(){


$(this).children(0).eq(1).children(0).attr('checked',($("#checkall1").is(':checked'))?true:false);


});


});


function VerifyAllOrNone(colIndex)


{


var ctrChk=0;


var ctrUnChk=0;


var rowCount=0;


$("#grdView tr").each(function(){


if (!this.rowIndex) return;


if($(this).children(0).eq(colIndex).children(0).is(':checked'))


ctrChk++;


else


ctrUnChk++;


rowCount++;


});


$("#checkall"+colIndex).attr('checked',(ctrUnChk==rowCount)?false:true);


$("#checkall"+colIndex).attr('checked',(ctrChk==rowCount)?true:false);




}


$("#grdView").click(function(e){


var $nxtIndex = 0;


var $cell = $(e.target);




var $colIndex = $cell.parents("td")[0].cellIndex;


var $rowIndex = $cell.parents("tr")[0].rowIndex;;


if($colIndex==0 || $colIndex==1)


{


$nxtIndex =($colIndex==0)?1:0;


checkMutuallyExclusive($colIndex,$nxtIndex,$rowIndex);


VerifyAllOrNone($colIndex);


}


});


function checkMutuallyExclusive(colIndex,nxtIndex,rowIndex)


{


var $chk1 = $("#grdView tr").eq(rowIndex).children(0).eq(colIndex).children(0);


var $chk2 = $("#grdView tr").eq(rowIndex).children(0).eq(nxtIndex).children(0);




if($chk1.is(":checked") && $chk2.is(":checked"))


$chk2.attr("checked",false);


if($chk1.is(":checked") && rowIndex==0)


DeselectAll(nxtIndex);


else


if($chk2.is(":checked") && rowIndex==0)


DeselectAll(colIndex);


VerifyAllOrNone(colIndex);


VerifyAllOrNone(nxtIndex);


}




function DeselectAll(colIndex)


{


$("#grdView tr").each(function(){


$(this).children(0).eq(colIndex).children(0).attr('checked',false);


});


}


});


</script>


</head>


<body>


<table id=grdView>


<tr><td><input type=checkbox id=checkall0 /></td><td><input type=checkbox id=checkall1 /></td><td>Description</td></tr>


<tr><td><input type=checkbox id=grdView11 /></td><td><input type=checkbox id=grdView21 /></td><td>Desc 1</td></tr>


<tr><td><input type=checkbox id=grdView12 /></td><td><input type=checkbox id=grdView22 /></td><td>Desc 2</td></tr>


<tr><td><input type=checkbox id=grdView13 /></td><td><input type=checkbox id=grdView23 /></td><td>Desc 3</td></tr>


<tr><td><input type=checkbox id=grdView14 /></td><td><input type=checkbox id=grdView24 /></td><td>Desc 4</td></tr>


<tr><td><input type=checkbox id=grdView15 /></td><td><input type=checkbox id=grdView25 /></td><td>Desc 5</td></tr>


<tr><td><input type=checkbox id=grdView16 /></td><td><input type=checkbox id=grdView26 /></td><td>Desc 6</td></tr>


</table>


</body>


</html>


Feel free to get back to me in case of any issues.

Monday, August 17, 2009

10 Free N Cool jquery LightBoxes

Lightbox is a simple, unobtrusive, light-weight script used to overlay images on the current page. It's a snap to setup and works on all modern browsers.
Lightbox can be used for any kind of web site popup works. Instead of sticking to image gallery, you can even use it for your user login consoles, prompts and even messageboxes. Here are some of the cool, free to use jquery sample lightboxes:

  1. pirobox - jQuery lightbox[Demo]

    pirobox - jQuery lightbox

    Pirobox - jquery light box is developed by PIROLAB. pirobox - jQuery lightbox completely Built with jQuery library. Automatically resizes images based on browser window size. pirobox Browser compatibility : FireFox 2-3, Opera 9.0, Chrome, Safari (Mac/Windows), Internet (damned) explorer 6-7-8.

  2. Fullsize - A new IMG Tag Attribute[Demo]

    Fullsize - A new IMG Tag Attribute

    The Full-size - A new IMG Tag Attribute next version of HTML from addfullsize. Fullsize is an attempt to get a new attribute called fullsize into the next version of HTML. Hopefully this site will get the attention of the W3C, and they will add fullsize to HTML and make it a standard. There are MANY fantastic javascript/AJAX solutions out there to view a larger version of an image by displaying it as a in-page pop-up or lightbox pop-up.

  3. boxy - Facebook like lightbox plugin[Demo]

    boxy - Facebook like lightbox plugin

    Boxy is a flexible, Facebook-style dialog box for jQuery with support for dragging and size tweening. It differs from other overlays I've seen by providing an object interface to control dialogs after they've been created.

  4. FancyBox-Jquery[Demo]

    FancyBox-Jquery lightbox

    FancyBox is tool for displaying images, html content and multi-media in a Mac-style "lightbox" that floats overtop of web page. It was built using the jQuery library. Licensed under the MIT License. easily Customizable through settings and CSS.

  5. jQuery Lightbox Plugin (balupton edition)[Demo]

    jQuery Lightbox Plugin (balupton edition)

    jQuery Lightbox Plugin (balupton edition) is a light weighted (Only 21KB in size ) unique Lightboxes which add Titles and descriptions for images. Automatically additional files are included . So you only have to include one js file, and it does the rest. Easily configurable via many options, and extensible via custom events. So no file modifications are required. Lightbox automatic scroll and resize functionality .

  6. jQuery Superbox![Demo]

    jQuery-Superbox!

    jQuery Superbox! is a plugin for jQuery which allows you to create easily customizable modal windows like lightbox effect. This script is a plugin for jQuery only use the rel attribute of an element for launch the script & href attribute is used for defining the source to be displayed in modal windows . easily Customizable. Superbox doesn't set any style, everything is easily and entirely CSS stylable. you can change the look as per you requirement. it released under MIT license. this license allows you to use, duplicate, modify, publish, distribute, merge, sell and even change the script license. Your only obligation is to keep the script's author name.

  7. New JavaScript Popup Box -TinyBox[Demo]

    jquery Popup light Box -TinyBox

    TinyBox is a lightweight {Almost 3.5KB} modal window script.it allows you to add any AJAX or HTML content and can also be used for images and auto hiding alerts. The popups fade in/out and dynamically size based on the loaded content if enabled.you can Easily customize the style of pop-ups fade in /out through the simple CSS .

    Tiny Box has been tested on Firefox 2/3, IE 6/7/8, Opera, Safari and Chrome. This script is available free of charge for any project, personal or commercial, under the
    creative commons license .

  8. FancyZoom For jQuery[Demo]

    FancyZoom-For-jQuery

    FancyZoom For jQuery is nice lightbox alternative which has a Mac-like zoom effect . it Designed to view full-size photos and images inline without requiring a separate web page load. it mainly focus on the smoothest, most polished zooming animation possible, Automatically scales images from any image link, with no HTML changes,Preloads full-size images in the background on link mouse over, No resource-heavy JavaScript libraries — 100% coded from scratch to zoom, it Uses Safari 3's "box-shadow" feature to draw the drop shadow natively, no images required. with only two new lines of code added in your HTML to use fancyzoom. it has been tested on Safari, Firefox, IE7, and IE6. (Looks better in modern browsers.)

  9. NyroModal box[Demo]

    NyroModal-box

    NyroModal box is W3C valid jquery plugin for lightbox. Ability to block only one element. easily Customizable animation and look of lightbox. It can display any type of HTML objects:

    • Form with file upload with targeting content
    • Form with file upload
    • Form with targeting content
    • Form in iframe
    • Form
    • Gallery with any kind of content
    • Images Gallery with arrow navigating
    • by showing a hidden DOM element
    • Single Image
    • with Ajax requests
    • Iframe

    Besides the features mentioned, you can target the content inside an Ajax request or a form, resize the modal window from an Ajax request & more.

  10. Shadowbox[Demo]

    Shadowbox - Online Media Viewer

    Shadowbox is an online media viewer application that supports all of the web's most popular media publishing formats. like ; Flash, QuickTime, and Windows Media Player browser plugins. Windows media files are supported on the Mac via the Flip4Mac QuickTime plugin.

    Shadowbox is highly customizable online media viewer application written entirely in JavaScript and CSS and it has been tested on Internet Explorer 6+, Firefox 1.5+, Safari 2+ , Chrome 1 and Opera 9+ and all JavaScript Frameworks. Shadowbox can be used easily with the popular JavaScript frameworks as it already has adapters for jQuery, Prototype + Scriptaculous, Ext.js & Yahoo! User Interface Library.


But this is just the icing on the cake. You have loads and loads of such lightboxes and popup controls possible in jquery with ease. Go ahead and explore the best out of jquery. Trust me, you will love it.. :-D

Tuesday, August 11, 2009

Free Online Video Editing Sites

You might be wondering that editing videos is gonna need a software to be installed in your machine and you need to learn the tutorials and stuffs. And in most of the cases, we end up not having enough Disk Space to install such large software's (Adobe Premiere Pro, ULead, AutoDesk Combustion etc..).

All I am saying is don't worry coz we have something called the Internet here. Now all you need for editing a video is:

  1. A video to edit (can be from anywhere- YouTube, Facebook, MySpace etc..)
  2. Internet connection (Broadband connection preferred)
  3. Adobe Flash Player for IE or Mozilla (not mandatory, depends on the site)

Here are some of the cool sites that offer Video Editing:

Go ahead and check them out… J

None of these free services is going to put installed video editors like Pinnacle Studio or the $800 Adobe Premiere Pro out of business. But these free online services offer a way for regular Joes to have fun manipulating their digital content and also give them an easy way to share them with friends and the world at large.

Free Online Image Editing Sites

You might be wondering that editing images is gonna need a software to be installed in your machine and you need to learn the tutorials and stuffs. And in most of the cases, we end up not having enough Disk Space to install such large software's (Adobe Photoshop, Illustrator, Paint .Net, ULead PhotoStudio etc..).

All I am saying is don't worry coz we have something called the Internet here. Now all you need for editing a video is:

  1. Images to edit (can be from anywhere- Facebook, MySpace, Picasa, Flickr etc..)
  2. Internet connection (Broadband connection preferred)

Here are some of the cool sites that offer Image Editing:

Go ahead and check them out… J

None of these free services is going to put installed image editors like ULead or the $700 Adobe Photoshop out of business. But these free online services offer a way for regular Joes to have fun manipulating their image content and also give them an easy way to share them with friends and the world at large.

Sunday, August 9, 2009

How to Validate your CSS?

Validating your HTML and CSS code for standards compliance has certain benefits: it protects your pages from problems arising from syntax errors in your code due to different ways of interpreting errors by the search engines and other browsers. If, however, you have a large number of existing pages that have not been validated and corrected, but nonetheless work well in search engines and other browsers, you might need to consider some sort of strategy to prevent webmaster-overload.

The best validator which i still prefer is from W3C :
Click here to validate your CSS

Its simple and effective for cross platform and cross browser compatibility testing.

Monday, July 27, 2009

CSS Hacks: !Important

Internet Explorer 6 and below had a problem with the !important identifier that caused it to be ignored if another declaration of the same property appeared later in the same style declaration block. This can be used to feed Internet Explorer 6 and below special property values that are ignored by other browsers. Internet Explorer 7 fixed this issue.

Here is an example of this technique in use:


 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html lang="en">

    <head>

        <title>Test</title>

        <style type="text/css">

            p

            {

                background: green !important; /* Major browsers other than IE 6 and below respect the importance immediately */

                background: red; /* IE 6 and below use this value instead, even though the above was marked as important */

            }

        </style>

    </head>

    <body class="page-body">

        <p>Test</p>

    </body>

</html>

CSS Hacks: Conditional Comments

Dealing with browser inconsistencies often makes up a majority of the work for a web designer. Sometimes there is no reasonable way to accomplish a desired layout in all major web browsers without the use of some special exception rules for certain layout engines. Hacks necessarily lead to potential complications and should be avoided whenever possible, but when the circumstances require hacks to be used, it's best to know what your options are and weigh the consequences appropriately. The purpose of this article is to describe some of the CSS hacks, also called CSS filters, with the least significant potential consequences.

Conditional Comments:

Conditional comments are specially constructed HTML comments that Internet Explorer on Windows may treat differently from other browsers, optionally based on IE's version number. They can cause Internet Explorer to ignore the markup between comments or to include part of a comment as if it was regular markup.

The most beneficial aspect of conditional comments is that you are not relying on browser bugs when using them. When you use CSS hacks that rely on browser bugs, you run into the possibility of those bugs being fixed at an unwanted time or other browsers showing the same bugs. Conditional comments only work in browsers that specifically support them and claim to be based on Internet Explorer, which in this case all known browsers are honest about.

There are two forms of conditional comments: positive and negative. A positive conditional comment will expose the included markup only to web browsers that match the condition (meaning only the selected versions of Internet Explorer). A negative conditional comment will expose the markup only to web browsers that don't match the condition (meaning all non-IE web browsers and any versions of IE that the condition didn't match). Note that, since versions of IE older than IE 5 don't support conditional comments, you may get unexpected results in those browsers.

The syntax for conditional comments is as follows:

Positive

<!--[if condition]> HTML <![endif]-->

Negative

<!--[if !condition]><![IGNORE[--><![IGNORE[]]> HTML <!--<![endif]-->

condition is one of the following:

Condition

Meaning

IE

Any version of IE (5, 5.5, 6, 7, 8)

lt IE version

Versions less than version

IE version

Only version version

gte IE version

Versions greater than or equal to version

version is the version of Internet Explorer, typically 5, 5.5, 6, 7 or 8


 

HTML is the HTML to be included if the condition does or doesn't match, depending on the type of conditional comment. When included, the HTML is placed right where the conditional comment is in the source.

For negative conditions, <![IGNORE[--><![IGNORE[]]> can be replaced with --> if the condition is simply IE. The longer version is only needed when Internet Explorer might parse the contents.

The <![IGNORE[ ... ]]> directive is not available in XML, so it is illegal to use it in XHTML. A solution would be to split it up into two special conditional comments: <!--[if !condition]> XHTML <![endif]--> <!--[if !IE]>--> XHTML <!--<![endif]--> where XHTML is the same both places. Note that Internet Explorer 7 and below don't yet recognize XHTML as a form of XML, so this is merely forward-looking.

How to apply width to IE and not firefox

Well the solution is simple. All you need is the knowledge of some keyword that IE recognises while setting the property value, while Mozilla ignores it.

Few solutions:
1. Using Expressions:
div#maincontainer{
width:300px;
/* IE and mozilla will take the width as 300px */
width:expression('100%');
/* But now mozilla will ignore this statement, but IE will take it
End result: In IE the div gets rendered with a width of 100%, but
in Mozilla it get rendered with a width of 300px */
}


2. Using separate stylesheet for IE and Mozilla
Add the following in the head tag of your page, wherein you add the reference to stylesheet.
< !--[if IE]>
< type="text/css">
< @import url('iespecific.css');
< /style>
< ![endif]-->

3. Using Incremental Overrides
div{ } /* Works for all */
* html div { } /* Works for IE */


There can be a lot of other hacks out there. Do explore your options. Hope this gives you a headstart.


Photoshop Toolbox Video Tutorials

Most of those new to Photoshop might find it difficult to get on your feet after having a look at the Toolbox on the left. Even i had it the very first time. That's quite normal. But don't get dejected. Here i am listing the tools that you normally see in your Photoshop Toolbox.

Not only that, each of the tool icons will take you to a tutorial page, that you can go and have a look at how that tool works.

Photoshop Toolbox Tutorials

Tool

Key

Purpose

Elliptical Marquee

M

selecting

Rectangular Marquee

M

selecting

Lasso

L

selecting

Polygonal Lasso

L

selecting

Magnetic Lasso

L

selecting

Slice

K

web design

Healing Brush

J

retouching

Brush

B

painting

Clone Stamp

S

painting

History Brush

Y

restores to selected history state

Airbrush

J

painting

Background Eraser

E

erasing

Paint Bucket

G

painting

Blur

R

unfocusing

Smudge

R

painting

Dodge

O

tonal adjustment

Horizontal Type

T

typing

Horizontal Type Mask

T

typing

Direct Selection

A

drawing

Pen

P

drawing

Add Anchor Point

-

drawing

Convert Point

-

drawing

Rounded Rectangle

U

drawing

Polygon

U

drawing

Custom Shape

U

drawing

Color Sampler

I

color information

Notes

N

non-printable data

Hand

H

navigating

Color Selecting box

-

displays current color

Mode Selector

Q

Selecting

Single Row Marquee

-

selecting

Single Column Marquee

selecting

Move

V

transforming

Magic Wand

W

selecting

Crop

C

transforming

Slice Select

K

web design

Patch

J

retouching

Pencil

B

painting

Pattern Stamp

S

painting

Art History Brush

Y

painting

Eraser

E

erasing

Magic Eraser

E

erasing

Gradient

G

painting

Sharpen

R

focusing

Sponge

O

color adjustment

Burn

O

tonal adjustment

Vertical Type

T

typing

Vertical Type Mask

T

typing

Path Selection

A

drawing

Freeform Pen

P

drawing

Delete Anchor Point

-

drawing

Rectangle

U

drawing

Ellipse

U

drawing

LIne

U

drawing

Eyedropper

I

choosing color

Measure

I

geometrical measurements

Audio Annotation

N

non-printable data

Zoom

Z

image viewing

Color Replacement

J

retouching

Jump to Image Ready

Shift+
Ctrl+
M

web design

Good Luck with the Photoshop works…:-D


Copyright © 2009 Aackose Mentu Lal
Best Viewed in 1024 x 768 Resolution