Showing posts with label Jquey Tutorial. Show all posts
Showing posts with label Jquey Tutorial. Show all posts

Friday, April 26, 2013

Image Slider Gallery Script in jQuery | Simple jquery code in Jquery | image slider in jquery

Now most of site are using image gallery and slider feature to your websites. Its very eye catching practice for user prospective.

But for implementing the image slider most of site developers use the ready to use jQuery scripts. Because its easy to implement and take less time to embed. We don't need to understand their logic's to use in our websites.

But it becomes very hard to do some miner script changes which we need to implement for their projects due to back-end logic's and development. Because they jQuery Plugins gives their script code after minify them which is totally unreadable and changeable also.

Here I am providing you simple script code logic for implementing the image slider. I hope it will help to understand logic and jQuery to you guys.

HTML Source Code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Gallery</title>
    <script src="http://code.jquery.com/jquery-1.9.1.js" type="text/javascript"></script>
    <script src="js/GalleryJson.js" type="text/javascript"></script>
    <style type="text/css">
        body{background: #ddd;}
       .container img,.container a{width: 100px;height: 100px;border: none;}
        .container ul{float: left;margin: 0;padding: 0;position: relative;}
        .container li{display: inline;list-style-type: none;margin-right: 10px;float:left;}
        .container li img{border: solid 2px transparent;}
        .container .disable{cursor: default;color: #999;}
        .container{position: relative;float: left;width: 100px;overflow: hidden;}
    </style>
</head>
<body>
    <div class="container" id="gallery1">
        <ul class="gal">
            <li><a href="javascript:void(0);">
                <img src="css/1.jpg" /></a></li>
            <li><a href="javascript:void(0);">
                <img src="css/2.jpg" /></a></li>
            <li><a href="javascript:void(0);">
                <img src="css/3.jpg" /></a></li>
            <li><a href="javascript:void(0);">
                <img src="css/4.jpg" /></a></li>
            <li><a href="javascript:void(0);">
                <img src="css/5.jpg" /></a></li>
            <li><a href="javascript:void(0);">
                <img src="css/2.jpg" /></a></li>
        </ul>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {
            gallery({
                gallery: "gallery1",// Mandatory
                next: "next1", // optional default value "gallery1next"
                prev: "prev2", // optional default value "gallery1prev"
                slide: 2, // optional default value 1
                auto: true // optional default value False
            });
        });
    </script>
</body>
</html>

Here I am providing GalleryJson.js source code with detail.

Jquery Script Code
gallery = function (options) {
    var counter = 0;
    var defaults = { "next": options.gallery + "next", "prev": options.gallery + "prev", "slide": 1, "auto": false };
    var obj = $.extend(defaults, options);

    var liWidth = $("#" + obj.gallery).find("li").outerWidth(true); // Width of single li
    var liCount = $("#" + obj.gallery).find("li").length; // Count of lis into UL

    // Insert Previous and Next button into gallary
    $("#" + obj.gallery).append('<a href="#" class="' + obj.prev + '">Prev</a> &nbsp;&nbsp;&nbsp; <a href="#" class="' + obj.next + '">Next</a>');
    $("#" + obj.gallery).find("ul").width(liWidth * liCount);  // Calculate gallary total width
    $("#" + obj.gallery).width(liWidth * obj.slide); // Set width of wrapper according to thumbnail count;


    if (counter == 0) // Default disable status for previous button on page load
    {
        $($("." + obj.prev)).addClass("disable");
    }


    // Code for previous button Click
    $("." + obj.prev).on("click", function () {
        if (counter > 0) {
            counter--;
            $("." + obj.next).removeClass("disable");
            $("#" + obj.gallery).find("ul").animate({ "left": "+=" + liWidth });
            if (counter == 0) { $(this).addClass("disable"); }
        }
        else { $(this).addClass("disable"); }
    });


    // Code for nexgt button Click
    $("." + obj.next).on("click", function () {
        if (counter < (liCount - obj.slide)) {
            counter++;
            $("." + obj.prev).removeClass("disable");
            $("#" + obj.gallery).find("ul").animate({ "left": "-=" + liWidth });
            if (counter == (liCount - obj.slide)) { $(this).addClass("disable"); }
        }
        else { $(this).addClass("disable"); }
    });


    // Auto Run Script Start Here
    if (obj.auto == true) {
        t = setTimeout(function () { autorun() }, 2000);
    }


    function autorun() {
        clearTimeout(t);
        if ($("#" + obj.gallery).find("." + obj.next).hasClass("disable")) {
            $("." + obj.prev).addClass("disable");
            $("#" + obj.gallery).find("ul").animate({ "left": 0 });
            $("." + obj.next).removeClass("disable");
            counter = 0;
        }
        else {
            $("." + obj.next).trigger("click");
        }
        t = setTimeout(function () { autorun() }, 2000);
    }
    // Auto Run Script Ends Here
};

Here I have provided you my Hand Written Script for Simple Image Gallery with details why and how it's working. I hope this code will help you to learn Slideshow animation of jquery.

If you guys want to modify or enhance any kind of its feature or have any suggestions please ask for it. So that i can improve my ability of writing jquery codes.

Thursday, January 3, 2013

Basic Questions in Jquery, Interview Questions for UI Developer, Interview Questions for JQuery, Interview Question ask by Recuriter in jQuery

Q1     What is jQuery ?
Ans.   jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, animating, event handling, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. Jquery is build library for javascript no need to write your own functions or script jquery all ready done for you.


Q2    What the use of $ symbol in Jquery?
Ans:  $ Symbol is just replacement of jquery means at the place of $ you may use jquery hence $ symbol is used for indication that this line used for jquery.


Q3:  How do you select an item using css class or ID and get the value by use of jquery?
Ans: If an element of html like &lt; div&gt; , &lt; p&gt; or any tag have ID MyId and class used MyClass then we select the element by below jquery code
Code:
$('#MyId') for ID and for classs $('.MyClass')
and for value
Code:
var myValue = $('#MyId').val();
// get the value in var Myvalue by id
Or for set the value in selected item

Code:
$('#MyId').val("print me");
// set the value of a form input


Q4:   What are the different type of selectors in Jquery?
Ans:  There are 3 types of selectors in Jquery
1. CSS Selector
2. XPath Selector
3. Custom Selector



Q5:   How can you select all elements in a page using jQuery?
Ans:  To select all elements in a page, we can use all selectors, for that we need to use *(asterisk symbol).
<script language="javascript" type="text/javascript">
         $("*").css("border", "2px dotted red");
</script>


Q6:   What is the use of EQ in Jquery?
Ans:  The eq( index ) method reduces the set of matched elements to a single element.
Syntax:
Here is the simple syntax to use this method:
selector.eq( index )


Q6:   What is the difference between height and outerheight in jquery?
Ans:  The .height() method gets or sets the height of the HTML element. To get the height of an HTML element, you would use .height() like below:
        $("#myDiv").height();
The .outerHeight() method gets the height of the HTML element and includes the top and bottom padding and the border. If the argument is set to true, it will also include the top and bottom margins. The value is expressed in pixels (px) and is a numeric value. To get the outer height without the margins, you would use:
        $("#myDiv").outerHeight();


Q7:   What does .size() method of jquery return ?
Ans:  .size() method of jquery returns number of element in the object. That means that you can count the number of elements within an object.

For example :-
$(document).ready(function(){
 var Count = $("div").size();
 alert(Count);
});


Q8:  What document.ready() is use in jQuery?
Ans: It indicates that the DOM of the page is ready and we can start manipulating the DOM elements even though other parts
of the page content(e.g. images/other external resources) are not fully loaded.As soon as the DOM is loaded,
everything inside the (document).ready() should be load even before the page contents are loaded.


Q9:   What is diffrence between javascript onload and document.ready()?
Ans:   The onLoad function for the window object executes after the entire page is fully loaded.Untill DOM tree is completely created and all images/other associated resources (like audio files,video files etc) are fully loaded,this onLoad function is never executed and hence the script execution needs to wait till the page is loaded.

But the document.ready() method of JQuery indicates that the DOM of the page is ready and we can start manipulating the DOM elements even though other parts of the page content(e.g. images/other external resources) are not fully loaded. As soon as the DOM is loaded, everything inside the (document).ready() should be load even before the page contents are loaded.


Q10:  What is chaining method in jquery?
Ans:  In jQuery most of the methods returns a jQuery object that you can then use to call another method. This allows you to do command chaining, where you can perform multiple methods on the same set of elements, which is really neat because it saves you and the browser from having to find the same elements more than once.

Here's an example:
$('div').css('border','solid 1px red').attr('class','active');

Saturday, December 24, 2011

menu open on click and hide when we click outside of div or blank body

Most of time I got stuck when I see click menu into facebook and gmail for opening their account information.
I tried lots of time to make same kind of script or jquery code. But not able to find it anywhere on websites.

So tried to make it by myself and create a little jquery code which perform same work for me.

I hope this will help my designer friends to achieve that kind of functionality.


Example

<div class="userinfo">

        <a href="javascript:void(0);" class="selnot">User Info</a>
        <ul class="hide">
            <li class="user"><asp:Label ID="lblUserName" runat="server" Text=""></asp:Label></li>
            <li class="to"><asp:Label ID="lblTotalPost" runat="server" Text=""></asp:Label></li>
            <li class="fa"><asp:Label ID="lblTotalFcebookPost" runat="server" Text="Label"></asp:Label></li>
            <li class="in"><asp:Label ID="lblTotalLinkedinPost" runat="server" Text="Label"></asp:Label></li>
<li class="tw"><asp:Label ID="lblTotalTwitterPost" runat="server" Text="Label"></asp:Label></li>
<li class="out"><asp:LinkButton ID="lnkBtnLogout" runat="server" OnClick="lnkBtnLogout_Click">Logout</asp:LinkButton></li>
        </ul>
    </div>
    <script type="text/javascript">
        $(".selnot").click(function() {

            if ($(this).next("ul").attr("class") == "show") {
                $(this).next("ul").removeClass("show");
                $(this).next("ul").addClass("hide");
            }
            else {
                if ($(this).next("ul").attr("class") == "hide") {
                    $(this).next("ul").removeClass("hide");
                    $(this).next("ul").addClass("show");
                }
            }
        });

    $(document).click(function(e) {
            if (e.target.className != "selnot") {
                $("ul").removeClass("show");
                $("ul").addClass("hide");
            }
        });

    </script>

This Jquery use DOCUMENT Click to find on which Class we have made click.
If its not our menu class it disable our Menu to show.

Monday, August 8, 2011

Blink effect in html, Blinking effect, Blinking effect using J-Query, new effect without image, jquery effect of changing color

Blinking text animation is use to catch the user attraction for a particular thing or feature.
This effect is widely use for New link, services, and feature of websites. We can achieve this blink effect using CSS by using CSS attribute.

But this CSS attribute do not have support for all browsers. I have created a simple jquery script code to do the Blink effect in my companies website to achieve the same feature.

Now I want to share that Script code with my web friends.

JQuery Script Code
var i = 1;



function color() {



//alert(1);



if (i == 1) {



$('.txt').css("color", "red");



i += 1;



return;



}



if (i == 2) {



$('.txt').css("color", "black");



i += 1;



return;



}



if (i == 3) {



$('.txt').css("color", "blue");



i += 1;



return;



}



if (i == 4) {



$('.txt').css("color", "orange");



i = 1;



return;



}



}



setInterval(color, 400);

Put this script code before end of body tag.
give the class name "txt" to text for whom you want color animation.

you can increase the time of changing color animation by increase the value of 400 to your value in code.

setInterval(color, 400);


you can also change the color code according to your requirement.

Also put Jquery Library file.
JavaScript Library File


Friday, July 22, 2011

javascript marquee example, JavaScript Marquee, horizontal scroller text using Jquery, Jquery tutorial to create Marquee effect, simple Jquery tmple Jquery to o create Marquee, horizontal ticker using jquery


Marquee is nice and useful feature for New news and promotions of website for which most of designer and Developers are used marquee tag and its attributes.

Now these days web accessibility is become must for websites due to make website GOOGLE friendly. So google can easily crawl them.

But according to W3C Marquee is not more with HTML tag family it shows error in W3C validation.

after searching long time to web I found the REPLACEMENT of Marquee using JQUERY and this information I would like to share with my designer and Developer friends using this Post.

Its very simple to use and implement into our website whether its Dynamic or static.

HTML CODE
<ul id='ticker02'>
 <li><a href="#">Hello 1</a></li>
 <li><a href="#">Hello 2</a></li>
 <li><a href="#">Hello 3</a></li>
 <li><a href="#">Hello 4</a></li>
 <li><a href="#">Hello 5</a></li>
</ul>
<script type="text/javascript" language="javascript"> 
//<![CDATA[ 
$(function(){ $("ul#ticker02").liScroll({travelocity: 0.03}); }); 
//]]> 
    </script>

CSS CODE

Now just need to add two Script file URL given Below you can save them too.
https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js
https://www.obcindia.co.in/obcnew/site/common/css/jquery.li-scroller.1.0.js


Saturday, July 16, 2011

Image Slide Show with Typing text effect, Jquery Tutorial for imagegallery, Typing text effect in Jquery, jQuery Image Galleries & Sliders

Last time I share some of Image gallery and slideshows for Image rotators having auto run and clicked event using Jquery.

also share another jquery slideshow and image gallery onhover effect having left scroller and right scroll depending on your mouse cursor position.


Today I am going to share one more simple image gallery with name of image and its description.  Using nice effect of typing to showing image name and its description.

Its easy to implement in your blog or site.

Here I am providing the Jquery tutorial for implementing the image gallery.

HTML Source

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head><title>
 PROMPT:: we envision. we deliver
</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/animation1.css" rel="stylesheet" type="text/css" />
<script src="http://web15346.38.ocpwebserver.com/meltbook/CSS/jquery-1.2.6.pack.js" type="text/javascript"></script>
<script src="css/scripts.js" type="text/javascript"></script>    
</head>
<body>
<div class="mid_ani">
<div id="header">
            <div class="wrap">
                <div id="slide-holder">
                    <div id="slide-runner">
                        <a href="">
                            <img id="slide-img-2" src="images/1.jpg" class="slide" alt="Prompt" /></a> <a href="">
                                <img id="slide-img-3" src="images/4.jpg" class="slide" alt="Prompt Solution" /></a> <a href="">
                                    <img id="slide-img-4" src="images/3.jpg" class="slide" alt="Prompt Solution Inc" /></a>
<a href="">
                            <img id="slide-img-5" src="images/0.jpg" class="slide" alt="Prompt Slide" /></a>
                        <div id="slide-controls">
                            <p id="slide-client" class="text">
                                <strong>post: </strong><span></span>
                            </p>
                            <p id="slide-desc" class="text">
                            </p>
<p id="slide-nav">
                            </p>
                        </div>
                    </div>
                    <!--content featured gallery here -->
                </div>

                <script type="text/javascript">
                    if (!window.slider) var slider = {}; slider.data = [
                                    { "id": "slide-img-2", "client": "nature beauty", "desc": "add your description here" },
                                    { "id": "slide-img-3", "client": "nature beauty", "desc": "add your description here" },
                                    { "id": "slide-img-4", "client": "nature beauty", "desc": "add your description here" },
                                    { "id": "slide-img-5", "client": "nature beauty", "desc": "add your description here"}];
                </script>

</div>
        </div>
        <!--/header-->
    </div>
</body>
</html>


scripts Code
window.onerror=function(desc,page,line,chr){
/* alert('JavaScript error occurred! \n'
  +'\nError description: \t'+desc
  +'\nPage address:      \t'+page
  +'\nLine number:       \t'+line
 );*/
}

$(function(){
 $('a').focus(function(){this.blur();});
 SI.Files.stylizeAll();
 slider.init();

 $('input.text-default').each(function(){
  $(this).attr('default',$(this).val());
 }).focus(function(){
  if($(this).val()==$(this).attr('default'))
   $(this).val('');
 }).blur(function(){
  if($(this).val()=='')
   $(this).val($(this).attr('default'));
 });

 $('input.text,textarea.text').focus(function(){
  $(this).addClass('textfocus');
 }).blur(function(){
  $(this).removeClass('textfocus');
 });

 var popopenobj=0,popopenaobj=null;
 $('a.popup').click(function(){
  var pid=$(this).attr('rel').split('|')[0],_os=parseInt($(this).attr('rel').split('|')[1]);
  var pobj=$('#'+pid);
  if(!pobj.length)
   return false;
  if(typeof popopenobj=='object' && popopenobj.attr('id')!=pid){
   popopenobj.hide(50);
   $(popopenaobj).parent().removeClass(popopenobj.attr('id').split('-')[1]+'-open');
   popopenobj=null;
  }
  return false;
 });
 $('p.images img').click(function(){
  var newbg=$(this).attr('src').split('bg/bg')[1].split('-thumb')[0];
  $(document.body).css('backgroundImage','url('+_siteRoot+'images/bg/bg'+newbg+'.jpg)');
 
  $(this).parent().find('img').removeClass('on');
  $(this).addClass('on');
  return false;
 });
 $(window).load(function(){
  //$.each(css_ims,function(){(new Image()).src=_siteRoot+'../images/'+this;});
  $.each(css_cims,function(){
   var css_im=this;
   $.each(['blue','purple','pink','red','grey','green','yellow','orange'],function(){
    (new Image()).src=_siteRoot+'css/'+this+'/'+css_im;
   });
  });
 }); 
 $('div.sc-large div.img:has(div.tml)').each(function(){
  $('div.tml',this).hide();
  $(this).append('<a href="#" class="tml_open">&nbsp;</a>').find('a').css({
   left:parseInt($(this).offset().left)+864,top:parseInt($(this).offset().top)+1
  }).click(function(){
   $(this).siblings('div.tml').slideToggle();
   return false;
  }).focus(function(){this.blur();}); 
 });
});
var slider={
 num:-1,
 cur:0,
 cr:[],
 al:null,
 at:10*1000,
 ar:true,
 init:function(){
  if(!slider.data || !slider.data.length)
   return false;

  var d=slider.data;
  slider.num=d.length;
  var pos=Math.floor(Math.random()*1);//slider.num);
  for(var i=0;i<slider.num;i++){
   $('#'+d[i].id).css({left:((i-pos)*1000)});
   $('#slide-nav').append('<a class="num" id="slide-link-' + i + '" href="#" onclick="slider.slide(' + i + ');return false;" onfocus="this.blur();">' + (i + 1) + '</a>');
  }

  $('img,div#slide-controls',$('div#slide-holder')).fadeIn();
  slider.text(d[pos]);
  slider.on(pos);
  slider.cur=pos;
  window.setTimeout('slider.auto();',slider.at);
 },
 auto:function(){
  if(!slider.ar)
   return false;

  var next=slider.cur+1;
  if(next>=slider.num) next=0;
  slider.slide(next);
 },
 slide:function(pos){
  if(pos<0 || pos>=slider.num || pos==slider.cur)
   return;

  window.clearTimeout(slider.al);
  slider.al=window.setTimeout('slider.auto();',slider.at);

  var d=slider.data;
  for(var i=0;i<slider.num;i++)
   $('#'+d[i].id).stop().animate({left:((i-pos)*1000)},1000,'swing');
  
  slider.on(pos);
  slider.text(d[pos]);
  slider.cur=pos;
 },
 on:function(pos){
  $('#slide-nav a').removeClass('on');
  $('#slide-nav a#slide-link-'+pos).addClass('on');
 },
 text:function(di){
  slider.cr['a']=di.client;
  slider.cr['b']=di.desc;
  slider.ticker('#slide-client span',di.client,0,'a');
  slider.ticker('#slide-desc',di.desc,0,'b');
 },
 ticker:function(el,text,pos,unique){
  if(slider.cr[unique]!=text)
   return false;

  ctext=text.substring(0,pos)+(pos%2?'-':'_');
  $(el).html(ctext);

  if(pos==text.length)
   $(el).html(text);
  else
   window.setTimeout('slider.ticker("'+el+'","'+text+'",'+(pos+1)+',"'+unique+'");',30);
 }
};
// STYLING FILE INPUTS 1.0 | Shaun Inman <http://www.shauninman.com/> | 2007-09-07
if(!window.SI){var SI={};};
SI.Files={
 htmlClass:'SI-FILES-STYLIZED',
 fileClass:'file',
 wrapClass:'cabinet',
 
 fini:false,
 able:false,
 init:function(){
  this.fini=true;
 },
 stylize:function(elem){
  if(!this.fini){this.init();};
  if(!this.able){return;};
  
  elem.parentNode.file=elem;
  elem.parentNode.onmousemove=function(e){
   if(typeof e=='undefined') e=window.event;
   if(typeof e.pageY=='undefined' &&  typeof e.clientX=='number' && document.documentElement){
    e.pageX=e.clientX+document.documentElement.scrollLeft;
    e.pageY=e.clientY+document.documentElement.scrollTop;
   };
   var ox=oy=0;
   var elem=this;
   if(elem.offsetParent){
    ox=elem.offsetLeft;
    oy=elem.offsetTop;
    while(elem=elem.offsetParent){
     ox+=elem.offsetLeft;
     oy+=elem.offsetTop;
    };
   };
  };
 },
 stylizeAll:function(){
  if(!this.fini){this.init();};
  if(!this.able){return;};
 }
};


Animation1 CSS Code
a img {
border : 0;
}

div.wrap a,div.wrap a:hover
{
    color:#fff;
}
div.wrap {
width : 980px;
margin : 0 auto;
text-align : left;
}
div#top div#nav {
float : left;
clear : both;
width : 980px;
height : 52px;
margin : 22px 0 0;
}
div#top div#nav ul {
float : left;
width : 700px;
height : 52px;
list-style-type : none;
}
div#nav ul li {
float : left;
height : 52px;
}
div#nav ul li a {
border : 0;
height : 52px;
display : block;
line-height : 52px;
text-indent : -9999px;
}
div#header {
margin : -1px 0 0;
}
div#video-header {
height : 683px;
margin : -1px 0 0;
}
div#header div.wrap {
height : 235px;
background : url(../images/ani.png) no-repeat left top ;
}
div#header div#slide-holder {
z-index : 40;
width : 980px;
height : 236px;
position : absolute;
}
div#header div#slide-holder div#slide-runner {
top : 1px;
left : 1px;
width : 975px;
height : 224px;
overflow : hidden;
position : absolute;
}
div#header div#slide-holder img {
margin : 0;
display : none;
position : absolute;
}
div#header div#slide-holder div#slide-controls {
left : 0;
bottom : 0px;
width : 973px;
height : 30px;
display : none;
position : absolute;
background : url(../images/images/slide-bg.png) 0 0;
}
div#header div#slide-holder div#slide-controls p.text {
float : left;
color : #fff;
display:none;
display : inline;
font-size : 10px;
line-height : 16px;
margin : 5px 0 0 20px;
text-transform : uppercase;
}
div#header div#slide-holder div#slide-controls p#slide-nav {
float : right;
height : 17px;
display : inline;
margin : 2px 5px 0 0;
font-size : 0px;
}
div#header div#slide-holder div#slide-controls p#slide-nav a {
float : left;
width : 24px;
height : 24px;
display : inline;
font-size : 11px;
color:#fff;
line-height:22px;
margin : 0 5px 0 0;
font-weight : bold;
text-align : center;
text-decoration : none;
background-position : 0 0;
background-repeat : no-repeat;
}
div#header div#slide-holder div#slide-controls p#slide-nav a.on {
background-position : 0 -24px;
}
div#header div#slide-holder div#slide-controls p#slide-nav a {
background-image : url(../images/images/silde-nav1.png);
}
div#nav ul li a {
background : url(../images/images/nav.png) no-repeat;
}

Tuesday, July 12, 2011

Jquey Tutorial for Slideshow, Jquery Image gallery, Image galley with description using Jquery, Image Slideshow using Lightbox in Jquery Image Slideshow using Lightbox in Jquery

while searching for Slideshow(image gallery) I found Jquery light box plugin which use Modelbox (Light box) to view show gallery image and its description.

This image gallery is too easy to implement on our websites.

jQuery lightBox plugin is simple, elegant, unobtrusive, no need extra markup and is used to overlay images on the current page through the power and flexibility of jQuery's selector.

Here I am providing the tutorial to implement the image gallery.

HTML Source Code
<div id="gallery">
    <ul>
        <li>
            <a href="http://leandrovieira.com/projects/jquery/lightbox/photos/image1.jpg" title="put your descript here">
                <img src="http://leandrovieira.com/projects/jquery/lightbox/photos/thumb_image1.jpg" width="72" height="72" alt="" />
            </a>
        </li>
        <li>
            <a href="http://leandrovieira.com/projects/jquery/lightbox/photos/image2.jpg" title="put your descript here">
                <img src="http://leandrovieira.com/projects/jquery/lightbox/photos/thumb_image2.jpg" width="72" height="72" alt="" />
            </a>
        </li>
        <li>
            <a href="http://leandrovieira.com/projects/jquery/lightbox/photos/image3.jpg" title="put your descript here">
                <img src="http://leandrovieira.com/projects/jquery/lightbox/photos/thumb_image3.jpg" width="72" height="72" alt="" />
            </a>
        </li>
        <li>
            <a href="http://leandrovieira.com/projects/jquery/lightbox/photos/image4.jpg" title="put your descript here">
                <img src="http://leandrovieira.com/projects/jquery/lightbox/photos/thumb_image4.jpg" width="72" height="72" alt="" />
            </a>
        </li>
        <li>
            <a href="http://leandrovieira.com/projects/jquery/lightbox/photos/image5.jpg" title="put your descript here">
                <img src="http://leandrovieira.com/projects/jquery/lightbox/photos/thumb_image5.jpg" width="72" height="72" alt="" />
            </a>
        </li>
    </ul>
</div>

CSS and Script
http://119.82.71.124/fb/jquey_lightbox/js/jquery.js
http://119.82.71.124/fb/jquey_lightbox/js/jquery.lightbox-0.5.js
http://119.82.71.124/fb/jquey_lightbox/css/jquery.lightbox-0.5.css
<script type="text/javascript">
    $(function() {
        $('#gallery a').lightBox();
    });
    </script>
       <style type="text/css">
    /* jQuery lightBox plugin - Gallery style */
    #gallery {
        background-color: #444;
        padding: 10px;
        width: 520px;
    }
    #gallery ul { list-style: none; }
    #gallery ul li { display: inline; }
    #gallery ul img {
        border: 5px solid #3e3e3e;
        border-width: 5px 5px 20px;
    }
    #gallery ul a:hover img {
        border: 5px solid #fff;
        border-width: 5px 5px 20px;
        color: #fff;
    }
    #gallery ul a:hover { color: #fff; }
    </style>

Modification
Here we mention the ID selector name in which the gallery exist. you can use any of id exist in you webpage.


$(function() {
        $('#gallery a').lightBox();
    });



Image and thumbnail information

BIG Image: Anchor tags href contain the URL of Bigger image which has to be open after click on image thumbnails.


Description: For inserting Description of image we need to mention all description into anchor tag's TITLE attribute.

Thumb: For Thumbnail we use IMG tag as small image.

<a href="http://leandrovieira.com/projects/jquery/lightbox/photos/image1.jpg" title="put your descript here">
                <img src="http://leandrovieira.com/projects/jquery/lightbox/photos/thumb_image1.jpg" width="72" height="72" alt="" />
            </a>



Wednesday, July 6, 2011

jquery tutorial for check all checkbox, Select Multiple checkbox, JQuery Check and Uncheck All Checkboxes

This function is specially designed for dynamic pages with varying numbers of checkboxes.

I found same functionality in JavaScript too but we can't use same script for two control.

So i decide to create Jquery for same script here I am providing both SCRIPT code for JavaScript and Jquery.

JavaScript
function SetAllCheckBoxes(FormName, FieldName, CheckValue)
{
 if(!document.forms[FormName])
  return;
 var objCheckBoxes = document.forms[FormName].elements[FieldName];
 if(!objCheckBoxes)
  return;
 var countCheckBoxes = objCheckBoxes.length;
 if(!countCheckBoxes)
  objCheckBoxes.checked = CheckValue;
 else
  // set the check value for all check boxes
  for(var i = 0; i < countCheckBoxes; i++)
   objCheckBoxes[i].checked = CheckValue;
}



Jquery

 $('#ctl00_ContentPlaceHolder1_chkPending').live('click',function() {
            if(pending==0){
            $("#ctl00_ContentPlaceHolder1_chkPending").attr("checked", false);
            $("#ctl00_ContentPlaceHolder1_chkPendingList input:checkbox").each(function() {
                $(this).attr("checked", false);
            });
            pending=1;
            }
            else
            {
            $("#ctl00_ContentPlaceHolder1_chkPending").attr("checked", true);
            $("#ctl00_ContentPlaceHolder1_chkPendingList input:checkbox").each(function() {
                $(this).attr("checked", true);
            });
            pending=0;
            }
        });

Please do not forget to add Jquery library file.
https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js

You  all need to do is put two id's into script.
$("#ctl00_ContentPlaceHolder1_GridView1_ctl01_ChkAll").toggle

here  you need to put id of whom click you want to check all check-box .


$("#accordion1 input:checkbox").each
here you need to mention in which all check-box should be checked.

Tuesday, July 5, 2011

Jquery Smooth Navigation menu, DropDown Menus, MultiLvel DropDown Menu in Jquery, MultiLevel Menu on Click event

Smooth Navigation Menu is a multi level, CSS list based menu powered using jQuery that makes website navigation a smooth affair. And that's a good thing given the important role of this element in any site. The menu's contents can either be from direct markup on the page, or an external file and fetched via Ajax instead. And thanks to jQuery, a configurable, sleek "slide plus fade in" transition is applied during the unveiling of the sub menus. The menu supports both the horizontalvertical (sidebar) orientation. and

 This menu i found from Dynamic Drive Smooth Navigation Menu and used for multiple website.

because it provides the orientation based Menu. Means we can use this menu as HORIZONTAL and VERTICAL also.

But this menu is work on hover event.

By modifying its jquery I able to run it on click event.

 


Wednesday, June 22, 2011

Jquery Form validator, Form Validation, Regular form validation mail

Here I am providing form validation code for regular expression using jquery. Just comment the field you don't want.

Live Demo

Tuesday, June 14, 2011

Jquery Tutorial for accordion, javascript Accordion, Jquery Slide animation

Here I explaing you how to apply Javascript effects by using jQuery.
Jquery Plugin is used to implement lots of animation and work for those we are using Ajax.

LIVE DEMO


HTML Source Code

<div class="accordion">
 <h3>Question One Sample Text</h3>
 <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi malesuada, ante at feugiat tincidunt, enim massa gravida metus, commodo lacinia massa diam vel eros. Proin eget urna. Nunc fringilla neque vitae odio. Vivamus vitae ligula.</p>
 <h3>This is Question Two</h3>
 <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi malesuada, ante at feugiat tincidunt, enim massa gravida metus, commodo lacinia massa diam vel eros. Proin eget urna. Nunc fringilla neque vitae odio. Vivamus vitae ligula.</p>
 <h3>Another Questio here</h3>
 <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi malesuada, ante at feugiat tincidunt, enim massa gravida metus, commodo lacinia massa diam vel eros. Proin eget urna. Nunc fringilla neque vitae odio. Vivamus vitae ligula.</p>
 <h3>Sample heading</h3>
 <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi malesuada, ante at feugiat tincidunt, enim massa gravida metus, commodo lacinia massa diam vel eros. Proin eget urna. Nunc fringilla neque vitae odio. Vivamus vitae ligula.</p>
 <h3>Sample Question Heading</h3>
 <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi malesuada, ante at feugiat tincidunt, enim massa gravida metus, commodo lacinia massa diam vel eros. Proin eget urna. Nunc fringilla neque vitae odio. Vivamus vitae ligula.</p>
</div>

 CSS Source Code

<style type="text/css">
body {
 margin: 10px auto;
 width: 570px;
 font: 75%/120% Arial, Helvetica, sans-serif;
}
.accordion {
 width: 480px;
 border-bottom: solid 1px #c4c4c4;
}
.accordion h3 {
 background: #e9e7e7 url(images/arrow-square.gif) no-repeat right -51px;
 padding: 7px 15px;
 margin: 0;
 font: bold 120%/100% Arial, Helvetica, sans-serif;
 border: solid 1px #c4c4c4;
 border-bottom: none;
 cursor: pointer;
}
.accordion h3:hover {
 background-color: #e3e2e2;
}
.accordion h3.active {
 background-position: right 5px;
}
.accordion p {
 background: #f7f7f7;
 margin: 0;
 padding: 10px 15px 20px;
 border-left: solid 1px #c4c4c4;
 border-right: solid 1px #c4c4c4;
}
</style>

Jquey Source Code

<script type="text/javascript">
$(document).ready(function(){
 
 $(".accordion h3:first").addClass("active");
 $(".accordion p:not(:first)").hide();

 $(".accordion h3").click(function(){
  $(this).next("p").slideToggle("slow")
  .siblings("p:visible").slideUp("slow");
  $(this).toggleClass("active");
  $(this).siblings("h3").removeClass("active");
 });

});
</script>

Jquery Liabrary File

 Jquery Modification

$(".accordion p:not(:first)").hide();
 this code Reefer that first P tag will not close else all will be close by default.
If you want to hide all tabs just comment this line in jquery code.
You can any of tag like DIV, SPAN instead of using P tag.
you can also modified the css as well as i did one of my project.
ONLINE Link  if you need any other modification feel free to write me.

Monday, June 13, 2011

Image Gallery with onhover Scroll, javaScript Tutorial for Smooth DIV Scroll

I have found one of very good Jquery image gallery or horizontal scroll animation for contents.

its a Jquery plugin use to scroll content horizontally on mouse over it shows its left and right when you have content to be showed.

I am presenting here its filtered HTML and CSS code for SmoothDIVScroll gallery.

you can find complete Detail for SmoothDivScroll by visting its website.

Smooth DIV Scroll

HTML Source

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Basic demo - jQuery Smooth Div Scroll</title>
    <!-- the CSS for Smooth Div Scroll -->
    <link rel="Stylesheet" type="text/css" href="css/smoothDivScroll.css" />
    <!-- jQuery library - I get it from Google API's -->

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript"></script>
 <link href="css/smoothDivScroll.css" rel="stylesheet" type="text/css" />

    <script src="js/jquery.ui.widget.js" type="text/javascript"></script>

   


    <script src="js/jquery.smoothDivScroll-1.1-min.js" type="text/javascript"></script>

    <script type="text/javascript">
        // Initialize the plugin with no custom options
        $(window).load(function() {
            $("div#makeMeScrollable").smoothDivScroll({});
        });
    </script>

    <!-- Styles for my specific scrolling content -->
    <style type="text/css">
        #makeMeScrollable
        {
            width: 100%;
            height: 330px;
            position: relative;
        }
        #makeMeScrollable div.scrollableArea img
        {
            position: relative;
            float: left;
            margin: 0;
            padding: 0;
        }
    </style>
</head>
<body>
    <div id="makeMeScrollable">
        <div class="scrollingHotSpotLeft">
        </div>
        <div class="scrollingHotSpotRight">
        </div>
        <div class="scrollWrapper">
            <div class="scrollableArea">
                <img src="images/field.jpg" alt="Demo image" />
                <img src="images/gnome.jpg" alt="Demo image" />
                <img src="images/pencils.jpg" alt="Demo image" />
                <img src="images/golf.jpg" alt="Demo image" />
                <img src="images/river.jpg" alt="Demo image" />
                <img src="images/train.jpg" alt="Demo image" />
                <img src="images/leaf.jpg" alt="Demo image" />
            </div>
        </div>
    </div>
</body>
</html>

CSS Source

/* You can alter this CSS in order to give SmoothDivScroll your own look'n'feel */

/* Invisible left hotspot */
div.scrollingHotSpotLeft
{
    /* The hotspots have a minimum width of 100 pixels and if there is room the will grow
    and occupy 15% of the scrollable area (30% combined). Adjust it to your own taste. */
    min-width: 75px;
    width: 10%;
    height: 100%;
    /* There is a big background image and it's used to solve some problems I experienced
    in Internet Explorer 6. */
    background-image: url(../images/arrow_left.png);
    background-position:center center;
    background-repeat: no-repeat;
    background-position: center center;
    position: absolute;
    z-index: 200;
    left: 0;
    display:none;
}

/* Visible left hotspot */
div.scrollingHotSpotLeftVisible
{
    background-image: url(../images/arrow_left.gif);               
    background-color: #fff;
    background-repeat: no-repeat;
    opacity: 0.35; /* Standard CSS3 opacity setting */
    -moz-opacity: 0.35; /* Opacity for really old versions of Mozilla Firefox (0.9 or older) */
    filter: alpha(opacity = 35); /* Opacity for Internet Explorer. */
    zoom: 1; /* Trigger "hasLayout" in Internet Explorer 6 or older versions */
}

/* Invisible right hotspot */
div.scrollingHotSpotRight
{
    min-width: 75px;
    width: 10%;
    height: 100%;
    background-image: url(../images/arrow_right.png);
    background-position:center center;
    background-repeat: no-repeat;
    background-position: center center;
    position: absolute;
    z-index: 200;
    right: 0;
}

/* Visible right hotspot */
div.scrollingHotSpotRightVisible
{
    background-image: url(../images/arrow_right.gif);
    background-color: #fff;
    background-repeat: no-repeat;
    opacity: 0.35;
    filter: alpha(opacity = 35);
    -moz-opacity: 0.35;
    zoom: 1;
}

/* The scroll wrapper is always the same width and height as the containing element (div).
   Overflow is hidden because you don't want to show all of the scrollable area.
*/
div.scrollWrapper
{
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

div.scrollableArea
{
    position: relative;
    width: auto;
    height: 100%;
}

JavaScript Script files
jquery.smoothDivScroll-1.1-min.js
js/jquery.ui.widget.js
jquery.min.js 
 
 
 
 

Wednesday, June 8, 2011

JavaScript Content Slider, Content Scrollbar using JavaScript, Custom JavaScript Scrollbar tutorial

Here I am providing the details how to create Custom Scrollbar for WebPage.
So now you are not bound to use browser's inbuilt scrollbar.

Create your own Fancy Scrollbar for your Website with Easy Step.

HTML Source
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0054)http://www.n-son.com/scripts/jsScrolling/example2.html -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>jsScrollbar</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">.Container {
 BACKGROUND: url(images/container_background.gif) #fff no-repeat; LEFT: 100px; WIDTH: 400px; POSITION: absolute; TOP: 50px; HEIGHT: 600px
}
#Scroller-1 {
 OVERFLOW: hidden; WIDTH: 420px; POSITION: absolute; HEIGHT: 490px
}
#Scroller-1 P {
 PADDING-RIGHT: 20px; PADDING-LEFT: 20px; FONT-SIZE: 11px; PADDING-BOTTOM: 10px; MARGIN: 0px; COLOR: #6f6048; TEXT-INDENT: 20px; PADDING-TOP: 10px; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
}
.Scroller-Container {
 LEFT: 0px; POSITION: absolute; TOP: 0px
}
#Scrollbar-Container {
 LEFT: 60px; POSITION: absolute; TOP: 40px
}
.Scrollbar-Up {
 CURSOR: pointer; POSITION: absolute
}
.Scrollbar-Track {
 BACKGROUND: url(scrollbar_track.gif) repeat-y center center; LEFT: 4px; WIDTH: 20px; 
 POSITION: absolute; TOP: 36px; HEIGHT: 490px
}
.Scrollbar-Handle {
 WIDTH: 20px; POSITION: absolute; HEIGHT: 22px
}
.Scrollbar-Down {
 CURSOR: pointer; POSITION: absolute; TOP: 517px
}
</style>

    <script src="jsScrollbar_files/jsScroller.js" type="text/javascript"></script>
<script src="jsScrollbar_files/jsScrollbar.js" type="text/javascript"></script>

    <script type="text/javascript">
var scroller  = null;
var scrollbar = null;
window.onload = function () {
  scroller  = new jsScroller(document.getElementById("Scroller-1"), 600, 200);
  scrollbar = new jsScrollbar (document.getElementById("Scrollbar-Container"), scroller, false);
}
</script>

</head>
<body>
    <div id="Scrollbar-Container">
        <img class="Scrollbar-Up" src="jsScrollbar_files/up_arrow.gif">
        <img class="Scrollbar-Down" src="jsScrollbar_files/down_arrow.gif">
        <div class="Scrollbar-Track">
<img class="Scrollbar-Handle" src="jsScrollbar_files/scrollbar_handle.gif">
        </div>
    </div>
    <div class="Container">
        <div id="Scroller-1">
            <div class="Scroller-Container">
                <p>
                    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec iaculis, ante et
                    congue feugiat, elit wisi commodo metus, ut commodo ligula enim ac justo. Pellentesque
                    id ligula. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
                    inceptos hymenaeos. Phasellus vitae mi a elit dictum volutpat. Pellentesque nec
                    arcu. Etiam blandit. Phasellus egestas dolor ut lacus. Sed enim justo, sagittis
                    ut, condimentum non, ullamcorper eu, neque. In hac habitasse platea dictumst. Integer
                    ipsum risus, sagittis ac, imperdiet ac, interdum sed, libero. Praesent commodo.
                    Mauris congue, urna eget hendrerit elementum, dolor ligula ultrices neque, in elementum
                    ante erat et elit.</p>
<p>
                    Vivamus vehicula. Integer cursus massa et nisl. Morbi pretium sem eget risus. Vestibulum
                    nec est. Donec feugiat purus et ligula. Quisque semper. Sed eu ante. Curabitur suscipit
                    porttitor libero. Nam eros leo, sollicitudin eget, tincidunt vitae, facilisis a,
                    dui. Proin neque. Aliquam erat volutpat. Pellentesque felis.</p>
                <p>
                    Aliquam consequat. Proin feugiat ultricies dui. Suspendisse mollis dui nec nunc.
                    Nam tristique, ante vitae imperdiet vestibulum, elit nulla rhoncus nisl, vitae tincidunt
                    dolor dui eu mi. In hac habitasse platea dictumst. Nunc blandit dolor vel mauris.
                    Proin wisi. Nam pharetra ultrices tellus. Sed arcu. Lorem ipsum dolor sit amet,
                    consectetuer adipiscing elit. Nullam ultricies semper wisi. Sed nisl. Donec blandit.
                    Nunc vitae urna sed nisl mattis ornare.</p>
                <p>
                    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec iaculis, ante et
                    congue feugiat, elit wisi commodo metus, ut commodo ligula enim ac justo. Pellentesque
                    id ligula. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
                    inceptos hymenaeos. Phasellus vitae mi a elit dictum volutpat. Pellentesque nec
                    arcu. Etiam blandit. Phasellus egestas dolor ut lacus. Sed enim justo, sagittis
                    ut, condimentum non, ullamcorper eu, neque. In hac habitasse platea dictumst. Integer
                    ipsum risus, sagittis ac, imperdiet ac, interdum sed, libero. Praesent commodo.
                    Mauris congue, urna eget hendrerit elementum, dolor ligula ultrices neque, in elementum
                    ante erat et elit.</p>
                <p>
Vivamus vehicula. Integer cursus massa et nisl. Morbi pretium sem eget risus. Vestibulum
                    nec est. Donec feugiat purus et ligula. Quisque semper. Sed eu ante. Curabitur suscipit
                    porttitor libero. Nam eros leo, sollicitudin eget, tincidunt vitae, facilisis a,
                    dui. Proin neque. Aliquam erat volutpat. Pellentesque felis.</p>
                <p>
                    Aliquam consequat. Proin feugiat ultricies dui. Suspendisse mollis dui nec nunc.
                    Nam tristique, ante vitae imperdiet vestibulum, elit nulla rhoncus nisl, vitae tincidunt
                    dolor dui eu mi. In hac habitasse platea dictumst. Nunc blandit dolor vel mauris.
                    Proin wisi. Nam pharetra ultrices tellus. Sed arcu. Lorem ipsum dolor sit amet,
                    consectetuer adipiscing elit. Nullam ultricies semper wisi. Sed nisl. Donec blandit.
                    Nunc vitae urna sed nisl mattis ornare.</p>
                <p>
                    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec iaculis, ante et
                    congue feugiat, elit wisi commodo metus, ut commodo ligula enim ac justo. Pellentesque
                    id ligula. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
                    inceptos hymenaeos. Phasellus vitae mi a elit dictum volutpat. Pellentesque nec
                    arcu. Etiam blandit. Phasellus egestas dolor ut lacus. Sed enim justo, sagittis
                    ut, condimentum non, ullamcorper eu, neque. In hac habitasse platea dictumst. Integer
                    ipsum risus, sagittis ac, imperdiet ac, interdum sed, libero. Praesent commodo.
                    Mauris congue, urna eget hendrerit elementum, dolor ligula ultrices neque, in elementum
                    ante erat et elit.</p>
                <p>
                    Vivamus vehicula. Integer cursus massa et nisl. Morbi pretium sem eget risus. Vestibulum
                    nec est. Donec feugiat purus et ligula. Quisque semper. Sed eu ante. Curabitur suscipit
                    porttitor libero. Nam eros leo, sollicitudin eget, tincidunt vitae, facilisis a,
                    dui. Proin neque. Aliquam erat volutpat. Pellentesque felis.</p>
<p>
                    Aliquam consequat. Proin feugiat ultricies dui. Suspendisse mollis dui nec nunc.
                    Nam tristique, ante vitae imperdiet vestibulum, elit nulla rhoncus nisl, vitae tincidunt
                    dolor dui eu mi. In hac habitasse platea dictumst. Nunc blandit dolor vel mauris.
                    Proin wisi. Nam pharetra ultrices tellus. Sed arcu. Lorem ipsum dolor sit amet,
                    consectetuer adipiscing elit. Nullam ultricies semper wisi. Sed nisl. Donec blandit.
                    Nunc vitae urna sed nisl mattis ornare.</p>
                <p>
                    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec iaculis, ante et
                    congue feugiat, elit wisi commodo metus, ut commodo ligula enim ac justo. Pellentesque
                    id ligula. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
                    inceptos hymenaeos. Phasellus vitae mi a elit dictum volutpat. Pellentesque nec
                    arcu. Etiam blandit. Phasellus egestas dolor ut lacus. Sed enim justo, sagittis
                    ut, condimentum non, ullamcorper eu, neque. In hac habitasse platea dictumst. Integer
                    ipsum risus, sagittis ac, imperdiet ac, interdum sed, libero. Praesent commodo.
                    Mauris congue, urna eget hendrerit elementum, dolor ligula ultrices neque, in elementum
                    ante erat et elit.</p>
                <p>
                    Vivamus vehicula. Integer cursus massa et nisl. Morbi pretium sem eget risus. Vestibulum
                    nec est. Donec feugiat purus et ligula. Quisque semper. Sed eu ante. Curabitur suscipit
                    porttitor libero. Nam eros leo, sollicitudin eget, tincidunt vitae, facilisis a,
                    dui. Proin neque. Aliquam erat volutpat. Pellentesque felis.</p>
                <p>
Aliquam consequat. Proin feugiat ultricies dui. Suspendisse mollis dui nec nunc.
                    Nam tristique, ante vitae imperdiet vestibulum, elit nulla rhoncus nisl, vitae tincidunt
                    dolor dui eu mi. In hac habitasse platea dictumst. Nunc blandit dolor vel mauris.
                    Proin wisi. Nam pharetra ultrices tellus. Sed arcu. Lorem ipsum dolor sit amet,
                    consectetuer adipiscing elit. Nullam ultricies semper wisi. Sed nisl. Donec blandit.
                    Nunc vitae urna sed nisl mattis ornare.</p>
                <p>
                    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec iaculis, ante et
                    congue feugiat, elit wisi commodo metus, ut commodo ligula enim ac justo. Pellentesque
                    id ligula. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
                    inceptos hymenaeos. Phasellus vitae mi a elit dictum volutpat. Pellentesque nec
                    arcu. Etiam blandit. Phasellus egestas dolor ut lacus. Sed enim justo, sagittis
                    ut, condimentum non, ullamcorper eu, neque. In hac habitasse platea dictumst. Integer
                    ipsum risus, sagittis ac, imperdiet ac, interdum sed, libero. Praesent commodo.
                    Mauris congue, urna eget hendrerit elementum, dolor ligula ultrices neque, in elementum
                    ante erat et elit.</p>
                <p>
                    Vivamus vehicula. Integer cursus massa et nisl. Morbi pretium sem eget risus. Vestibulum
                    nec est. Donec feugiat purus et ligula. Quisque semper. Sed eu ante. Curabitur suscipit
                    porttitor libero. Nam eros leo, sollicitudin eget, tincidunt vitae, facilisis a,
                    dui. Proin neque. Aliquam erat volutpat. Pellentesque felis.</p>
                <p>
                    Aliquam consequat. Proin feugiat ultricies dui. Suspendisse mollis dui nec nunc.
                    Nam tristique, ante vitae imperdiet vestibulum, elit nulla rhoncus nisl, vitae tincidunt
                    dolor dui eu mi. In hac habitasse platea dictumst. Nunc blandit dolor vel mauris.
                    Proin wisi. Nam pharetra ultrices tellus. Sed arcu. Lorem ipsum dolor sit amet,
                    consectetuer adipiscing elit. Nullam ultricies semper wisi. Sed nisl. Donec blandit.
                    Nunc vitae urna sed nisl mattis ornare.</p>
<p>
                    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec iaculis, ante et
                    congue feugiat, elit wisi commodo metus, ut commodo ligula enim ac justo. Pellentesque
                    id ligula. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
                    inceptos hymenaeos. Phasellus vitae mi a elit dictum volutpat. Pellentesque nec
                    arcu. Etiam blandit. Phasellus egestas dolor ut lacus. Sed enim justo, sagittis
                    ut, condimentum non, ullamcorper eu, neque. In hac habitasse platea dictumst. Integer
                    ipsum risus, sagittis ac, imperdiet ac, interdum sed, libero. Praesent commodo.
                    Mauris congue, urna eget hendrerit elementum, dolor ligula ultrices neque, in elementum
                    ante erat et elit.</p>
                <p>
                    Vivamus vehicula. Integer cursus massa et nisl. Morbi pretium sem eget risus. Vestibulum
                    nec est. Donec feugiat purus et ligula. Quisque semper. Sed eu ante. Curabitur suscipit
                    porttitor libero. Nam eros leo, sollicitudin eget, tincidunt vitae, facilisis a,
                    dui. Proin neque. Aliquam erat volutpat. Pellentesque felis.</p>
                <p>
                    Aliquam consequat. Proin feugiat ultricies dui. Suspendisse mollis dui nec nunc.
                    Nam tristique, ante vitae imperdiet vestibulum, elit nulla rhoncus nisl, vitae tincidunt
                    dolor dui eu mi. In hac habitasse platea dictumst. Nunc blandit dolor vel mauris.
                    Proin wisi. Nam pharetra ultrices tellus. Sed arcu. Lorem ipsum dolor sit amet,
                    consectetuer adipiscing elit. Nullam ultricies semper wisi. Sed nisl. Donec blandit.
                    Nunc vitae urna sed nisl mattis ornare.</p>
                <p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec iaculis, ante et
                    congue feugiat, elit wisi commodo metus, ut commodo ligula enim ac justo. Pellentesque
                    id ligula. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
                    inceptos hymenaeos. Phasellus vitae mi a elit dictum volutpat. Pellentesque nec
                    arcu. Etiam blandit. Phasellus egestas dolor ut lacus. Sed enim justo, sagittis
                    ut, condimentum non, ullamcorper eu, neque. In hac habitasse platea dictumst. Integer
                    ipsum risus, sagittis ac, imperdiet ac, interdum sed, libero. Praesent commodo.
                    Mauris congue, urna eget hendrerit elementum, dolor ligula ultrices neque, in elementum
                    ante erat et elit.</p>
                <p>
                    Vivamus vehicula. Integer cursus massa et nisl. Morbi pretium sem eget risus. Vestibulum
                    nec est. Donec feugiat purus et ligula. Quisque semper. Sed eu ante. Curabitur suscipit
                    porttitor libero. Nam eros leo, sollicitudin eget, tincidunt vitae, facilisis a,
                    dui. Proin neque. Aliquam erat volutpat. Pellentesque felis.</p>
                <p>
                    Aliquam consequat. Proin feugiat ultricies dui. Suspendisse mollis dui nec nunc.
                    Nam tristique, ante vitae imperdiet vestibulum, elit nulla rhoncus nisl, vitae tincidunt
                    dolor dui eu mi. In hac habitasse platea dictumst. Nunc blandit dolor vel mauris.
                    Proin wisi. Nam pharetra ultrices tellus. Sed arcu. Lorem ipsum dolor sit amet,
                    consectetuer adipiscing elit. Nullam ultricies semper wisi. Sed nisl. Donec blandit.
                    Nunc vitae urna sed nisl mattis ornare.</p>
            </div>
        </div>
</div>
</body>
</html>


JavaScript Laibrary File
JsScroller.js
JsScrollbar.js

Image File 
 
 

Create a unique Gallery by using z-index and jQuery, Image Rotator in Jquery, Jquery Tutorial for Image Rotaor amd gallery

Here I am posting a unique image rotator gallery created in Jquery having effect of Sliding the image to background with shuffling effect.

Please read the tutorial carefully to use Image Rotator and gallery.

HTML Source

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    
    <title>Demo for - 'Create a unique Gallery by using z-index and jQuery'</title>
    
    <link rel="stylesheet" type="text/css" media="screen" href="css/reset.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="css/960.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="css/main.css" />
    
    <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/demo.js"></script>
  </head>
  
  <body>
   
        <!-- relevant for the tutorial - start -->
        <div class="grid_6 prefix_1 suffix_1" id="gallery">
          <div id="pictures">
            <img src="images/picture1.png" alt="" />
            <img src="images/picture2.png" alt="" />
<img src="images/picture3.png" alt="" />
            <img src="images/picture4.png" alt="" />
            <img src="images/picture5.png" alt="" />
          </div>
          
          <div class="grid_3 alpha" id="prev">
            <a href="#previous">&laquo; Previous Picture</a>
          </div>
          <div class="grid_3 omega" id="next">
<a href="#next">Next Picture &raquo;</a>
          </div>
        </div>
        <!-- relevant for the tutorial - end -->
        
 
    </div>
  </body>
</html>


CSS Source Code
 
 /* Main Style Sheet start here */
html { font-size: 16px; min-height: 100%; margin-bottom: 1px; }
body { font-size: 62.5%; font-family: Verdana, Arial, sans-serif; color: #555555; background: #22384d url(../images/bg.jpg) repeat-x; }
a { color: #0F67A1; text-decoration: none; }
a:hover { text-decoration: underline; }

#wrapper { background: white url(../images/sidebar_bg.jpg) repeat-y top right; }

#content { }
  #content h1 { font-size: 2.4em; font-weight: normal; line-height: 32px; margin: 30px 0 50px 0; }
  #content p { font-size: 1.4em; line-height: 22px; margin-bottom: 20px; }
  
  /* relevant for the tutorial - start */
  #gallery { position: relative; }
    #pictures { position: relative; height: 408px; }
    #pictures img { position: absolute; top: 0; left: 0; }
    
    #prev, #next { margin-top: 30px; text-align: center; font-size: 2.0em; }
  /* relevant for the tutorial - end */
  
#footer { text-align: center; margin: 50px 0 20px 0; }

#sidebar { }
  #sidebar ul { margin-top: 20px; }
  #sidebar ul li { font-size: 1.2em; padding: 20px 0 20px 0; border-bottom: 1px solid #dddcdc; line-height: 18px; }
  #sidebar ul li h2 { font-size: 1.2em; margin-bottom: 8px; }
 
 /* Main Style Sheet Ends here */
 /* 960 Style Sheet start here */
 .container_12,.container_16{margin-left:auto;margin-right:auto;width:960px}.grid_1,.grid_2,.grid_3,.grid_4,.grid_5,.grid_6,.grid_7,.grid_8,.grid_9,.grid_10,.grid_11,.grid_12,.grid_13,.grid_14,.grid_15,.grid_16{display:inline;float:left;margin-left:10px;margin-right:10px}.container_12 .grid_3,.container_16 .grid_4{width:220px}.container_12 .grid_6,.container_16 .grid_8{width:460px}.container_12 .grid_9,.container_16 .grid_12{width:700px}.container_12 .grid_12,.container_16 .grid_16{width:940px}.alpha{margin-left:0}.omega{margin-right:0}.container_12 .grid_1{width:60px}.container_12 .grid_2{width:140px}.container_12 .grid_4{width:300px}.container_12 .grid_5{width:380px}.container_12 .grid_7{width:540px}.container_12 .grid_8{width:620px}.container_12 .grid_10{width:780px}.container_12 .grid_11{width:860px}.container_16 .grid_1{width:40px}.container_16 .grid_2{width:100px}.container_16 .grid_3{width:160px}.container_16 .grid_5{width:280px}.container_16 .grid_6{width:340px}.container_16 .grid_7{width:400px}.container_16 .grid_9{width:520px}.container_16 .grid_10{width:580px}.container_16 .grid_11{width:640px}.container_16 .grid_13{width:760px}.container_16 .grid_14{width:820px}.container_16 .grid_15{width:880px}.container_12 .prefix_3,.container_16 .prefix_4{padding-left:240px}.container_12 .prefix_6,.container_16 .prefix_8{padding-left:480px}.container_12 .prefix_9,.container_16 .prefix_12{padding-left:720px}.container_12 .prefix_1{padding-left:80px}.container_12 .prefix_2{padding-left:160px}.container_12 .prefix_4{padding-left:320px}.container_12 .prefix_5{padding-left:400px}.container_12 .prefix_7{padding-left:560px}.container_12 .prefix_8{padding-left:640px}.container_12 .prefix_10{padding-left:800px}.container_12 .prefix_11{padding-left:880px}.container_16 .prefix_1{padding-left:60px}.container_16 .prefix_2{padding-left:120px}.container_16 .prefix_3{padding-left:180px}.container_16 .prefix_5{padding-left:300px}.container_16 .prefix_6{padding-left:360px}.container_16 .prefix_7{padding-left:420px}.container_16 .prefix_9{padding-left:540px}.container_16 .prefix_10{padding-left:600px}.container_16 .prefix_11{padding-left:660px}.container_16 .prefix_13{padding-left:780px}.container_16 .prefix_14{padding-left:840px}.container_16 .prefix_15{padding-left:900px}.container_12 .suffix_3,.container_16 .suffix_4{padding-right:240px}.container_12 .suffix_6,.container_16 .suffix_8{padding-right:480px}.container_12 .suffix_9,.container_16 .suffix_12{padding-right:720px}.container_12 .suffix_1{padding-right:80px}.container_12 .suffix_2{padding-right:160px}.container_12 .suffix_4{padding-right:320px}.container_12 .suffix_5{padding-right:400px}.container_12 .suffix_7{padding-right:560px}.container_12 .suffix_8{padding-right:640px}.container_12 .suffix_10{padding-right:800px}.container_12 .suffix_11{padding-right:880px}.container_16 .suffix_1{padding-right:60px}.container_16 .suffix_2{padding-right:120px}.container_16 .suffix_3{padding-right:180px}.container_16 .suffix_5{padding-right:300px}.container_16 .suffix_6{padding-right:360px}.container_16 .suffix_7{padding-right:420px}.container_16 .suffix_9{padding-right:540px}.container_16 .suffix_10{padding-right:600px}.container_16 .suffix_11{padding-right:660px}.container_16 .suffix_13{padding-right:780px}.container_16 .suffix_14{padding-right:840px}.container_16 .suffix_15{padding-right:900px}.clear{clear:both;display:block;overflow:hidden;visibility:hidden;width:0;height:0}.clearfix:after{clear:both;content:'.';display:block;visibility:hidden;height:0}.clearfix{display:inline-block}* html .clearfix{height:1%}.clearfix{display:block}
 /* 960 Style Sheet Ends here */
 
 /* Reset Style Sheet Starts here */
/* v1.0 | 20080212 */

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
 margin: 0;
 padding: 0;
 border: 0;
 outline: 0;
 font-size: 100%;
 vertical-align: baseline;
 background: transparent;
}
body {
 line-height: 1;
}
ol, ul {
 list-style: none;
}
blockquote, q {
 quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
 content: '';
 content: none;
}

/* remember to define focus styles! */
:focus {
 outline: 0;
}

/* remember to highlight inserts somehow! */
ins {
 text-decoration: none;
}
del {
 text-decoration: line-through;
}

/* tables still need 'cellspacing="0"' in the markup */
table {
 border-collapse: collapse;
 border-spacing: 0;
}
 /* Reset Style Sheet Ends here */ 

Script Source Code
$(document).ready(function() { //perform actions when DOM is ready
    var z = 0; //for setting the initial z-index's
    var inAnimation = false; //flag for testing if we are in a animation

    $('#pictures img').each(function() { //set the initial z-index's
        z++; //at the end we have the highest z-index value stored in the z variable
        $(this).css('z-index', z); //apply increased z-index to <img>
    });

    function swapFirstLast(isFirst) {
        if (inAnimation) return false; //if already swapping pictures just return
        else inAnimation = true; //set the flag that we process a image

        var processZindex, direction, newZindex, inDeCrease; //change for previous or next image

        if (isFirst) { processZindex = z; direction = '-'; newZindex = 1; inDeCrease = 1; } //set variables for "next" action
        else { processZindex = 1; direction = ''; newZindex = z; inDeCrease = -1; } //set variables for "previous" action

        $('#pictures img').each(function() { //process each image
            if ($(this).css('z-index') == processZindex) { //if its the image we need to process
                $(this).animate({ 'top': direction + $(this).height() + 'px' }, 'slow', function() { //animate the img above/under the gallery (assuming all pictures are equal height)
                    $(this).css('z-index', newZindex) //set new z-index
            .animate({ 'top': '0' }, 'slow', function() { //animate the image back to its original position
                inAnimation = false; //reset the flag
            });
                });
            } else { //not the image we need to process, only in/de-crease z-index
                $(this).animate({ 'top': '0' }, 'slow', function() { //make sure to wait swapping the z-index when image is above/under the gallery
                    $(this).css('z-index', parseInt($(this).css('z-index')) + inDeCrease); //in/de-crease the z-index by one
                });
            }
        });

        return false; //don't follow the clicked link
    }
    function runauto() {
        swapFirstLast(true)
       // alert('hu');
        setTimeout(runauto, 3000);
    }
    runauto();
    $('#next a').click(function() {
        return swapFirstLast(true); //swap first image to last position
    });

    $('#prev a').click(function() {
        return swapFirstLast(false); //swap last image to first position
    });
});
 
JavaScript Library File



Share this link with your facebook profile if you like this.