Sunday, January 29, 2012

Cricket World Cup 2011 Final Match Highlight

 

What a Great Inning from Indian Captain MS Dhoni... :)

Monday, January 23, 2012

Working example of the tabSlideOut jQuery plugin

See that little tab over there that says 'Contact'? If you click that it will slide out. This plugin allows you to easily add one of those to your page.

The most important part of getting this plugin to work is to have your image path and image dimensions set correctly in the options. In this version, using the code below, I am linking directly to google code for the jquery library as well as the plugin which I am hosting at code.google.com.



View Demo 
Download Files 
Download Plugin


Getting started

In your <head> tag you need the javascript (with the options customized for your image):



<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>
<script src="http://tab-slide-out.googlecode.com/files/jquery.tabSlideOut.v1.3.js"></script>

    <script type="text/javascript">
    $(function(){
        $('.slide-out-div').tabSlideOut({
            tabHandle: '.handle',                     //class of the element that will become your tab
            pathToTabImage: 'images/contact_tab.gif', //path to the image for the tab //Optionally can be set using css
            imageHeight: '122px',                     //height of tab image           //Optionally can be set using css
            imageWidth: '40px',                       //width of tab image            //Optionally can be set using css
            tabLocation: 'left',                      //side of screen where tab lives, top, right, bottom, or left
            speed: 300,                               //speed of animation
            action: 'click',                          //options: 'click' or 'hover', action to trigger animation
            topPos: '200px',                          //position from the top/ use if tabLocation is left or right
            leftPos: '20px',                          //position from left/ use if tabLocation is bottom or top
            fixedPosition: false                      //options: true makes it stick(fixed position) on scroll
        });

    });

    </script>
 

Below that add your css:
 

<style type="text/css">
    .slide-out-div {
          padding: 20px;
          width: 250px;
          background: #ccc;
          border: 1px solid #29216d;
      }     
      </style>
                       

Anywhere in your page, (I put mine right above my </body>) put in the html for your hidden content.

        <div class="slide-out-div">
            <a class="handle" href="http://link-for-non-js-users.html">Content</a>
            <h3>Contact me</h3>
            <p>Thanks for checking out my jQuery plugin, I hope you find this useful.
            </p>
            <p>This can be a form to submit feedback, or contact info</p>
        </div>

       
                   

jQuery UI Tabs with Next/Previous

Tabbed areas are lovely, but when you start getting to more than 3 or 4 different tabs, they start to get a little crowded and it makes sense to provide alternative navigation of them. I think it makes sense to supply universally located Next/Previous buttons, so without even moving your cursor you can click through each of them.
View Demo   Download Files


jQuery UI makes creating tabbed areas very easy, so the framework is based on that. But we are on our own as far as Next/Previous buttons. Fortunately, jQuery UI tabs do have a function-thing that can be called to switch tabs. We can bind it to text links to accomplish switching tabs:


$('#my-text-link').click(function() { // bind click event to link
    $tabs.tabs('select', 2); // switch to third tab
    return false;
});



But we want to do this (hopefully) as smart-ly as we can. So we want to:

  1.     Add the links dynamically to each panel. If a panel is added or removed, the Next/Previous buttons  automatically adjust to the new flow. Plus, links won't be there awkwardly with JavaScript disabled
  2.     Make sure there is no "Previous" button on the first panel
  3.     Make sure there is no "Next" button on the last panel
This is how I did it:

$(function() {

        var $tabs = $('#tabs').tabs();

        $(".ui-tabs-panel").each(function(i){

          var totalSize = $(".ui-tabs-panel").size() - 1;

          if (i != totalSize) {
              next = i + 2;
                  $(this).append("<a href='#' class='next-tab mover' rel='" + next + "'>Next Page &#187;</a>");
          }

          if (i != 0) {
              prev = i;
                  $(this).append("<a href='#' class='prev-tab mover' rel='" + prev + "'>&#171; Prev Page</a>");
          }

        });

        $('.next-tab, .prev-tab').click(function() {
           $tabs.tabs('select', $(this).attr("rel"));
           return false;
       });

});

Thursday, January 19, 2012

काँच की बरनी और दो कप चाय

जीवन में जब सब कुछ एक साथ और जल्दी - जल्दी करने की इच्छा होती है , सब कुछ तेजी से पा लेने की इच्छा होती है , और हमें लगने लगता है कि दिन के चौबीस घंटे भी कम पड़ते हैं , उस समय ये बोध कथा , " काँच की बरनी और दो कप चाय " हमें याद आती है ।
दर्शनशास्त्र के एक प्रोफ़ेसर कक्षा में आये और उन्होंने छात्रों से कहा कि वे आज जीवन का एक महत्वपूर्ण पाठ पढाने वाले हैं ...
उन्होंने अपने साथ लाई एक काँच की बडी़ बरनी ( जार ) टेबल पर रखा और उसमें टेबल टेनिस की गेंदें डालने लगे और तब तक डालते रहे जब तक कि उसमें एक भी गेंद समाने की जगह नहीं बची ... उन्होंने छात्रों से पूछा - क्या बरनी पूरी भर गई ? हाँ ... आवाज आई ... फ़िर प्रोफ़ेसर साहब ने छोटे - छोटे कंकर उसमें भरने शुरु किये h धीरे - धीरे बरनी को हिलाया तो काफ़ी सारे कंकर उसमें जहाँ जगह खाली थी , समा गये , फ़िर से प्रोफ़ेसर साहब ने पूछा , क्या अब बरनी भर गई है , छात्रों ने एक बार फ़िर हाँ ... कहा अब प्रोफ़ेसर साहब ने रेत की थैली से हौले - हौले उस बरनी में रेत डालना शुरु किया , वह रेत भी उस जार में जहाँ संभव था बैठ गई , अब छात्र अपनी नादानी पर हँसे ... फ़िर प्रोफ़ेसर साहब ने पूछा , क्यों अब तो यह बरनी पूरी भर गई ना ? हाँ .. अब तो पूरी भर गई है .. सभी ने एक स्वर में कहा .. सर ने टेबल के नीचे से चाय के दो कप निकालकर उसमें की चाय जार में डाली , चाय भी रेत के बीच स्थित थोडी़ सी जगह में सोख ली गई ...
प्रोफ़ेसर साहब ने गंभीर आवाज में समझाना शुरु किया –
इस काँच की बरनी को तुम लोग अपना जीवन समझो ....
टेबल टेनिस की गेंदें सबसे महत्वपूर्ण भाग अर्थात भगवान , परिवार , बच्चे , मित्र , स्वास्थ्य और शौक हैं ,
छोटे कंकर मतलब तुम्हारी नौकरी , कार , बडा़ मकान आदि हैं , और
रेत का मतलब और भी छोटी - छोटी बेकार सी बातें , मनमुटाव , झगडे़ है ..
अब यदि तुमने काँच की बरनी में सबसे पहले रेत भरी होती तो टेबल टेनिस की गेंदों और कंकरों के लिये जगह ही नहीं बचती , या कंकर भर दिये होते तो गेंदें नहीं भर पाते , रेत जरूर आ सकती थी ...
ठीक यही बात जीवन पर लागू होती है ... यदि तुम छोटी - छोटी बातों के पीछे पडे़ रहोगे और अपनी ऊर्जा उसमें नष्ट करोगे तो तुम्हारे पास मुख्य बातों के लिये अधिक समय नहीं रहेगा ... मन के सुख के लिये क्या जरूरी है ये तुम्हें तय करना है । अपने बच्चों के साथ खेलो , बगीचे में पानी डालो , सुबह पत्नी के साथ घूमने निकल जाओ , घर के बेकार सामान को बाहर निकाल फ़ेंको , मेडिकल चेक - अप करवाओ ... टेबल टेनिस गेंदों की फ़िक्र पहले करो , वही महत्वपूर्ण है ... पहले तय करो कि क्या जरूरी है ... बाकी सब तो रेत है ..
छात्र बडे़ ध्यान से सुन रहे थे .. अचानक एक ने पूछा , सर लेकिन आपने यह नहीं बताया कि " चाय के दो कप " क्या हैं ? प्रोफ़ेसर मुस्कुराये , बोले .. मैं सोच ही रहा था कि अभी तक ये सवाल किसी ने क्यों नहीं किया ...
इसका उत्तर यह है कि , जीवन हमें कितना ही परिपूर्ण और संतुष्ट लगे , लेकिन अपने खास मित्र के साथ दो कप चाय पीने की जगह हमेशा होनी चाहिये ।

Monday, January 16, 2012

Especially for SMOKERS........



It is never too late to quit smoking.
Within the first 20 minutes of quitting, the healing process begins....
By the end of the first day after quitting smoking, you've decreased your chances of having a heart attack.The benefits will continue to improve your health and quality of life for years.

Within 12 hours after you have your last cigarette, your body will begin to heal itself. The levels of carbon monoxide and nicotine in your system will decline rapidly, and your heart and lungs will begin to repair the damage caused by cigarette smoke.As your body begins to repair itself, instead of feeling better right away, you may feel worse for a while. It's important to understand that healing is a process­ p;it begins immediately, but it continues over time. These "withdrawal pangs" are really symptoms of the recovery process.

Immediately after quitting, many ex-smokers experience "symptoms of recovery" such as temporary weight gain caused by fluid retention, irregularity, and dry, sore gums or tongue. You may feel edgy, hungry, more tired, and more short-tempered than usual and have trouble sleeping and notice that you are coughing a lot. These symptoms are the result of your body clearing itself of nicotine, a powerful addictive chemical. Most nicotine is gone from the body in 2-3 days.

Please spread awareness among smokers to quit smoking.
SHARING is caring ;)

Animated Landscape Using CSS and jQuery

After the launch of jQuery many web designer who face problem with javascript now moved to jQuery because of vast range of various effect support from jQuery including its compatibility with different website hosting. Jquery is one of the leading JavaScript framework available now. Just a basic of javascript is required to start using jQuery and implementing some great effect with little knowledge. Since some weeks we are writing jquery tutorials for our readers and today we created this beautiful tutorial and in the end of this tutorial we will learn to Create Animated Landscape using CSS and Jquery. So lets start learning it.

CHECK OUT DEMO

STEP 1 : ORGANIZE FILES

First of all we need to setup all our files which required in this tutorial, create one HTML file, CSS file and image folder which holds all our images

STEP 2 : HTML DOCUMENT

Here we need to write our html document first, which contains wrapper with fixed height and width and within it one container which holds all the elements of our page. Check out the code below



<div id="wrapper">
<div id="inner">
<div id="cloudone"><img src="images/clud1.png" alt="" /></div>
<div id="cloudtwo"><img src="images/clud2.png" alt="" /></div>
<div id="cloudthree"><img src="images/clud1.png" alt="" /></div>
<div id="boat"><img src="images/boat.png" alt="" /></div>
</div>
</div>


Final HTML Code

<div id="wrapper">
<div id="inner">
<div id="cloudone"><img src="images/clud1.png" alt="" /></div>
<div id="cloudtwo"><img src="images/clud2.png" alt="" /></div>
<div id="cloudthree"><img src="images/clud1.png" alt="" /></div>
<div id="boat"><img src="images/boat.png" alt="" /></div>
</div>
</div>



STEP 3 : CSS STYLING

Now some css styling is required. Important thing to keep in mind is to have overlay hidden for container(#inner) and position absolute for all the moving images. Here we will keep our moving images like clouds and boat out of the container with the help of negative left and right margin so that while using jquery we would have a nice effect. Check out the below CSS codes.



#wrapper {
    width:800px;
    height:600px;
       /* main background image with sky, sun, river and ground */
    background-image:url(images/Untitled-3.jpg);
    background-repeat:no-repeat;
    margin-top:10px;
    margin-left:auto;
    margin-right:auto;
    border: 10px solid #666;
}
#inner {
    position:relative;
    overflow:hidden;
    width:800px;
    height:600px;
    margin:0px;
}
#cloudone {
    position:absolute;
    margin-top:2px;
    margin-left:-200px;
    filter:alpha(opacity=80);
  /* CSS3 standard */
        opacity:0.8;
}
#cloudtwo {
    position:absolute;
    margin-top:80px;
    margin-left:-300px;
    filter:alpha(opacity=60);
  /* CSS3 standard */
        opacity:0.6;
}
#cloudthree {
    position:absolute;
    margin-top:60px;
    margin-left:-600px;
    filter:alpha(opacity=70);
  /* CSS3 standard */
        opacity:0.7;
}
#boat {
    margin-top:360px;
    position:absolute;
    margin-left:800px;


STEP 4 : JQUERY

First of all we need to tag below lines to the head of our html document.



<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js" type="text/javascript"><!--mce:0--></script>
<script src="landscape.js" type="text/javascript"><!--mce:1--></script>


Here we will using double animate function to animate clouds and boat. And to rotate clouds and boat will create one function to do this job. Check out below codes first.

Prepare yourself for world Top IT Certification with Selftest Engine, outstanding exam practice software

provide you everything that you require for Exams practice. If you’re interested to pass 050-728 and

HIO-301 exams. I recommend you to use practice exams.



function cloudone(){
    $("#cloudone").animate({left:"+=1200px"},10000).animate({left:"-200px"}, 0)
    setTimeout("cloudone()",10000);
}


In above codes, here we moved class id cloudone to +=1200px which means image will move 1200px of its right and to give sliding effect we used .animate function and the time taken to complete the slide would be 10 second. Now another .animate function will move the image to original position in time interval 0 sec and to start the rotation again we have sum the time intervals of both the animate functions and using setTimeout function we started the rotation loop again. This way animate all the images which you want to slide on the canvas. Check out below codes for more clarification.


function cloudone(){
   $("#cloudone").animate({left:"+=1200px"},10000).animate({left:"-200px"}, 0)
   setTimeout("cloudone()",10000);
}
function cloudtwo(){
   $("#cloudtwo").animate({left:"+=1500px"},15000).animate({left:"-300px"}, 0)
   setTimeout("cloudtwo()",15000);
}
function cloudthree(){
   $("#cloudthree").animate({left:"+=2000px"},20000).animate({left:"-600px"}, 0)
   setTimeout("cloudthree()",20000);
}
function boat(){
   //This time we need to move boat to left side so we put the margin to 1000px
   $("#boat").animate({right:"+=1000px"},20000).animate({right:"-200px"}, 0)
   setTimeout("boat()",20000);
}


Now we need to trigger all our functions ( cloudone(), cloudtwo(), cloudthree() ) the animation will begin as soon as the page load. Check out below codes.

For additional PC related image capturing devices, such as a DVR or security cameras that can be attached to, consider reviewing a security camera system from 123-cctv.com.



$(document).ready(function() {
    setTimeout("cloudone()",10);
    setTimeout("cloudtwo()",10);
    setTimeout("cloudthree()",10);
    setTimeout("boat()",10);
});


Final Codes

$(document).ready(function() {
    setTimeout("cloudone()",10);
    setTimeout("cloudtwo()",10);
    setTimeout("cloudthree()",10);
    setTimeout("boat()",10);
});
function cloudone(){
    $("#cloudone").animate({left:"+=1200px"},10000).animate({left:"-200px"}, 0)
    setTimeout("cloudone()",10000);
}
function cloudtwo(){
    $("#cloudtwo").animate({left:"+=1500px"},15000).animate({left:"-300px"}, 0)
    setTimeout("cloudtwo()",15000);
}
function cloudthree(){
    $("#cloudthree").animate({left:"+=2000px"},20000).animate({left:"-600px"}, 0)
    setTimeout("cloudthree()",20000);
}
function boat(){
    $("#boat").animate({right:"+=1000px"},20000).animate({right:"-200px"}, 0)
    setTimeout("boat()",20000);
}



Other types of images can be viewed from the web. These images can be collected when triggered by a home security camera system. For more information please contact Central Security Systems.

CHECK OUT DEMO

Try once our warm exam product like 350-001 study guide, 640-802 dumps, VCP-410 questions and answers product, 220-701 braindumps, and 70-646 dumps which will definitely prove helpful tool.

Sunday, January 15, 2012

Making an Interactive Picture with jQuery

In this tutorial I will be showing you how to piece together an interactive picture – aka an image that contains tooltips and popup boxes. This can be useful for showing off a particular aspect of a photo (ie items or people).
The original inspiration for this tutorial came from the IKEA website, which uses Flash to accomplish something similar, although admittedly with a few extra features.
 

See Demo

Tutorial Outline


  1. This tutorial will show you how to set up the basic structure for your own interactive picture.
  2. Create/Position “more info” buttons
  3. Add captions to buttons
  4. Link buttons to descriptions in popup info boxes

This tutorial will be most effective if used as a guide to customize the downloadable files.



Set Up Your Picture

Before we can place any buttons, we first have to get the image ready (I’ve chosen a picture of our office) . Let’s make the div #picture, which will act as our canvas.



#picture{ position:relative; top:20px; width:700px; height:466px; margin:0px auto; background:#FFF url('office.jpg'); overflow:hidden; } 


You will want to customize your dimensions and background image to match your selected image. Everything we will be doing will take place inside of this div tag.
 

Positioning Info Buttons

If you’ve taken the time to check out the live demo, you’ve probably also noticed the large “+” buttons scattered throughout the picture. These buttons are going to be the foundation of what we do, acting as markers within the image.


That being said, here is the HTML structure of a sample button, complete with comments to explain it.



<div class="more" id="couch"> <!-- id refers to specific item --> 
<a href="#"><img src="more.png"/></a> <!--defines button image, don't change link --> 
<span>IKEA Klippan Couch</span> <!-- The caption for the button --> 
</div>  



Each button pulls from a few CSS styles, the first is the general button styles, which you probably won’t have to customize much/at all.


/* General More Button */<span style="white-space: pre;"> </span>
.more{ position:absolute; width:50px; height:50px; background:url('dim.png'); border:1px solid #444; padding:5px; text-align:left; overflow:hidden; }
.more span{ position:absolute; left:60px; width:160px; padding:15px 0 0 5px; color:#FFF; font:bold 13px Lucida Grande, Arial, sans-serif; text-shadow:#000 1px 1px 0px; }



The second bit that affects a button is the unique CSS that positions the button over the corresponding area of the image.


/* Item Specific More Button */ 
#couch{ top:240px; left:75px;}  



Using this structure you can make as many buttons as you need for your image. We will be revisiting the buttons again in the jQuery section, where we will make the captions appear on hover.
 

The Info Box

When a visitor clicks any of the buttons, we want an info box to pop up from the bottom with the additional information inside. When this box pops up, the background should dim to call attention to the info box (I have done this before in my Lights Out tutorial).


The HTML for this goes as follows:



<!-- Info Boxes --> 
<div id="infobox"> 
<span class="close"><a href="#"><img src="close.png"/></a></span> 
<br/> 
<div id="couch_info"> 
<img src="klippan.jpg"/><br/> 
<a href="http://www.ikea.com/us/en/catalog/products/10138530">IKEA Klippan Couch</a> 
</div> 
</div> 
<!-- Dimmed Background --> 
<div id="fade_bg">&nbsp;</div>  



The CSS for this positions the info box in the dead center of the image, slaps a close button in the upper right, and covers the background in the semi-transparent png which dims the background. (Note: This will all be triggered by jQuery, so it will not show up yet)


/* General Info Box */ 
#infobox{ position:absolute; bottombottom:-200px; left: 350px; height:200px; width:300px; z-index:20; margin:0 0 -100px -150px; background:#FFF; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; } 
#infobox a, #infobox a:visited{ font:italic 16px Georgia, serif; color:#555; text-decoration:none; } 
#infobox a:hover{ text-decoration:underline; } 
span.close{position:absolute; rightright:5px; top:5px;} 
#fade_bg{ position:absolute; z-index:15; width:100%; height:100%; background:url('dim.png'); display:none;} 



Bringing It Together with jQuery

There is a bit a jQuery involved, so here’s the breakdown – ready, set, go.
This removes the dotted blue lines in all browsers when links are clicked.



//Blur Links (Prevents Outline) 
$('a').click(function() { 
this.blur(); 
}); 



In order to trim down the amount of markup, we are using the same info box for all the descriptions, and hiding the ones not in current use. This line runs through and hides all of the divs contained #infobox by default when the page loads.


//Hide all item descriptions in the info box 
$("#infobox > div").css("display", "none"); 



When a button is clicked, the info box gets triggered and slides in from the bottom. The dimmed background also fades in to view and we end the function by returning false so the link is not actually executed.


//Call in the info box 
$(".more a").click(function(){ 
$("#infobox").animate({bottom: '233px' }, 300); 
$("#fade_bg").fadeIn(); 
return false; 
});  



The info button expands to show it’s caption when the visitor hovers over it. Here you can customize the exact width it expands/retracts to. To prevent overlap between buttons, the button that is hovered over gets a high z-index temporarily.

//Expand more info button on hover 
$(".more").hover(function(){ 
$(this).stop().animate({width: '225px' }, 200).css({'z-index' : '10'}); 
}, function () { 
$(this).stop().animate({width: '50px' }, 200).css({'z-index' : '1'}); 
}); 



An example of a item description display function – you will need to duplicate this function for each button you have. This displays the correct item description in the info box when it slides into view.


//Show description for selected item 
$("#couch a").click(function(){ 
$("#couch_info").show(); 
}); 



When the dimmed background or close button gets clicked, the info box and background disappear and the descriptions are again all hidden.


//Remove background, info box and hide all descriptions 
$("#fade_bg, .close").click(function(){ 
$("#fade_bg").fadeOut(); 
$("#infobox").animate({bottom: '-200px' }, 300, function() { 
$("#infobox > div").css("display", "none"); 
}); 
return false; 
}); 


Final Product

I would strongly suggest using the downloadable files as a launching point, as it is easier to customize them for your own purposes rather than go from scratch. Lastly, I hope you enjoyed this tutorial and find it useful for a future project.




Text Resizing With jQuery

Ever wondered how to allow visitors to increase or decrease the text size (font size) on your website? I’m going to show you how - using jQuery (a great JavaScript library).


View Demo

CSS Font Size

Firstly, we should consider the various methods of specifying a font size using CSS. 4 CSS attributes pertaining to font sizing come to mind:

Size in ‘pixels’
Sixe in ‘points’
Size in ‘em’
Size as a percentage - ‘%’
For the purpose of this article, treat ‘em’ and ‘%’ as the same (where 1em is equivalent to 100%). When we allow visitors to change the font size, only elements with a font size set in ‘em’ or as a percentage will be variable. Elements without this attribute fall back to the value of their immediate parent element’s font-size. This means is that if you specify the value for an element’s font size in pixels, the font size will not change.

The JavaScript



$(document).ready(function(){
  // Reset Font Size
  var originalFontSize = $('html').css('font-size');
    $(".resetFont").click(function(){
    $('html').css('font-size', originalFontSize);
  });
  // Increase Font Size
  $(".increaseFont").click(function(){
    var currentFontSize = $('html').css('font-size');
    var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*1.2;
    $('html').css('font-size', newFontSize);
    return false;
  });
  // Decrease Font Size
  $(".decreaseFont").click(function(){
    var currentFontSize = $('html').css('font-size');
    var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*0.8;
    $('html').css('font-size', newFontSize);
    return false;
  });
});


One limitation of this short script is that the visitor’s preference is not saved. We could overcome this limitation by storing the font-size to a cookie.  Jonny and Fazal have cooked up some nice code that will do just this.  View the comment.

Jquery Accordion

Hi Friends, Here you will see Accordion in J query its really Easy and Amazing to use for Web Designers & Developers.


Here i will show you How !!!

Demo 


------------------------------------------------------------------------------------------------

Step 1


First Download JQuery File here


Step2

Place this Javascript code in <Head> tag

<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>


Step3

Place this CSS Style in <head> Tag


<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>


Step4

In Body Tag Place this whole Code


<div class="accordion">
    <h3 class="active">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 style="display: none; ">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 style="display: none; ">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 style="display: none; ">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 style="display: none; ">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>


Finish Enjoy Now

Wednesday, January 11, 2012

jquery custom content scroller

Custom scrollbar plugin utilizing jquery UI that’s fully customizable with CSS. It features vertical/horizontal scrolling, mouse-wheel support (via Brandon Aaron jquery mouse-wheel plugin), scroll easing and adjustable scrollbar height/width.






DEMO | DOWNLOAD


How to use it

In order to implement the plugin, you first need to insert inside the head tag of your document the jquery.min.js and jquery-ui.min.js (both loaded from Google), the jquery.easing.1.3.js (the plugin that handles animation easing), jquery.mousewheel.min.js (to support mouse-wheel functionality) and the jquery.mCustomScrollbar.css which is the file where you can style your content and scrollbars.
<link href="jquery.mCustomScrollbar.css" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js" type="text/javascript"></script>
<script src="jquery.easing.1.3.js" type="text/javascript"></script>
<script src="jquery.mousewheel.min.js" type="text/javascript"></script>

Next you’ll need to insert the markup of the content blocks you want to have custom scrollbars inside the body tag. The structure of the markup is exactly the same for every content block except the first div which should have a unique id (in this example: mcs_container).
<div id="mcs_container">
<div class="customScrollBox">
<div class="container">
<div class="content">
<p>Your long content goes here...</p></div>
</div>
<div class="dragger_container">
<div class="dragger"></div>
</div>
</div>
</div>

Keep the markup structure exactly as shown above, placing your content inside the div that has the class name content. In order to have multiple content blocks with custom scrollbars on a single document, you use the exact same markup with a unique id for each block (e.g. mcs_container, mcs2_container, mcs3_container etc.).

The markup for horizontal scrollers needs an additional div with class name horWrapper that wraps the .container div. This is necessary in order to set the total width of contents automatically, without the need to insert it by hand in css or make complicated calculations with javascript.
<div id="mcs_container">
<div class="customScrollBox">
<div class="horWrapper">
<div class="container">
<div class="content">
<p>Your long content goes here...</p></div>
</div>
<div class="dragger_container">
<div class="dragger"></div>
</div>
</div>
</div>
</div>

To add the additional scrollbar buttons, you need to insert two additional anchor tags inside mcs_container div, with class names scrollUpBtn and scrollDownBtn:
<div id="mcs_container">
<div class="customScrollBox">
<div class="container">
<div class="content">
<p>Your long content goes here...</p></div>
</div>
<div class="dragger_container"><div class="dragger"></div></div>
</div>
<!-- scroll buttons -->
<a class="scrollUpBtn" href="#"></a> <a class="scrollDownBtn" href="#"></a>
</div>
</div></div>

An extra feature suggested and provided by isHristov is to add a few lines of CSS right after your content markup, in order to help users that have javascript disabled scroll the content:
<noscript>
    <style type="text/css">
        #mcs_container .customScrollBox{overflow:auto;}
        #mcs_container .dragger_container{display:none;}
    </style>
</noscript>

The final step is to include the actual custom scrollbar plugin (jquery.mCustomScrollbar.js) and the function that calls and configures the scrollbar(s) at the end of your document, just before the closing body tag.
<script>
$(window).load(function() {
    $("#mcs_container").mCustomScrollbar("vertical",400,"easeOutCirc",1.05,"auto","yes","yes",10);
});
</script>
<script src="jquery.mCustomScrollbar.js" type="text/javascript"></script>

You can configure each content block scrollbar by setting the parameters of the function call:

    The scroll type (“vertical” or “horizontal”)
    The scroll easing amount (e.g. 400 for normal easing, 0 for no easing etc.)
    The scroll easing type
    The extra bottom scrolling space (applies to vertical scroll type only)
    Set the scrollbar height/width adjustment (“auto” for adjustable scrollbar height/width analogous to content length or “fixed” for fixed dimensions)
    Set mouse-wheel support (“yes” or “no”)
    Scrolling via buttons support (“yes” or “no”)
    Buttons scrolling speed (an integer between 1 and 20, with 1 indicating the slowest scroll speed)

Multiple scrollers

To set multiple content blocks with custom scrollbars on a single page, give them a unique id (keeping the exact markup) and add a function call for each one. For example:
<script>
$(window).load(function() {
    $("#mcs_container").mCustomScrollbar("vertical",400,"easeOutCirc",1.05,"auto","yes","yes",10);
    $("#mcs2_container").mCustomScrollbar("vertical",0,"easeOutCirc",1.05,"fixed","yes","no",0);
    $("#mcs3_container").mCustomScrollbar("vertical",900,"easeOutCirc",1.25,"auto","no","no",0);
});
</script>

You can style each scroller separately in jquery.mCustomScrollbar.css, since styles are assigned only to the element with the original id (see the .css file inside the jquery_custom_scroller.zip).

Scrolling long content

There’s a bug in jquery.min.js that resets to 0, an animate value greater than 9999 pixels. This bug will affect the scrollbar if content width or height is equal or greater than 10000 pixels, resulting a scrolling jerk. This annoying bug is going to be fixed on a future release of the library. Until then, we need to come up with a temporary solution and since editing jquery.min.js is not the best of practices, we’ll overwrite the jquery function containing the buggy code ;)
Insert the following code below the window load function:
<script>
/* function to fix the -10000 pixel limit of jquery.animate */
$.fx.prototype.cur = function(){
    if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
      return this.elem[ this.prop ];
    }
    var r = parseFloat( jQuery.css( this.elem, this.prop ) );
    return typeof r == 'undefined' ? 0 : r;
}
</script>

Dynamically loaded content

To load new content dynamically inside scroller(s) (via .load(), ajax requests etc.), you need to call (or re-call) mCustomScrollbar function after new content is loaded. For example:
$("#mcs_container .content").load("new.html", function(){
$("#mcs_container").mCustomScrollbar("vertical",400,"easeOutCirc",1.05,"auto","yes","yes",10);
});

When you have multiple content scrollers on a single page that load new content dynamically, it’s better to create another function that calls all scrollers and call it on window.load as well as each time new content is loaded. The demo includes this functionality, so you can check and grab the code.

Hiding content scrollers

If you want to have the scroller initially hidden, you need to hide it after calling the mCustomScrollbar function. This is important, in order for the script to calculate content width or height correctly.

Mousewheel scrolling with Safari on mac OS

Mousewheel scrolling with Safari browser on OSX might be extremely fast thus a bit unusable (blame the vendor!). I have uploaded a modified jquery.mCustomScrollbar.js at http://manos.malihu.gr/tuts/jquery_custom_scroller_js_osxsafari.zip that checks for mac OS and Safari browser to lower mousewheel delta. I haven’t implement the modification in the original plugin cause I don’t really fancy coding for specific operating systems or browsers.

If you need assistance with the script, please make sure you read the comments section (at the moment there are over 500 comments), as many users have answered questions and posted helpful bits of code ;)

Feel free to use the plugin wherever and however you like. Enjoy :)

Smooth Scrolling in jQuery

Single page websites seem to be all the rage now a days. Scrolling effects seem to be in high demand. So in this post I’ll show you how to create a smooth scrolling page with jQuery.

What are we building?

We’ll be creating our own fansy smansy website. The nav will sit fixed at the top. Once we click on a nav item it will scroll down to the section. Best of all, if JavaScript is shut off, it will degrade gracefull and just jump down to the section. 


See Demo | Download Source Files


The HTML : Content

First thing we need is some content to scroll. This can be anything as long as their is enough of it to scroll….otherwise this tutorial is pointless ;) At the top of each section we’ll need to specify an id (we’ll be using this for our navigation). It can be on anything. Really just put the id on what you want to appear at the top of the page. For this example I put it on the header tags.



<div class="container">
    <div class="section">
        <h1 id="html">HTML</h1>
        <p><!--Your HTML Content Goes HERE --></p>
    </div>
    <div class="section">
        <h1 id="css">CSS</h1>
        <p><!--Your HTML Content Goes HERE --></p>
    </div>
    <div class="section">
        <h1 id="php">PHP</h1>
        <p><!--Your HTML Content Goes HERE --></p>
    </div>
    <div class="section">
        <h1 id="javascript">JavaScript</h1>
        <p><!--Your HTML Content Goes HERE --></p>
    </div>
    <div class="section">
        <h1 id="jquery">jQuery</h1>
        <p><!--Your HTML Content Goes HERE --></p>
    </div>
</div>


 The HTML : Navigation

Now that we know what the ids are for each section we can go ahead and use those to create a navigation.



<div class="navigation">
    <a href="#html">HTML</a>
    <a href="#css">CSS</a>
    <a href="#php">PHP</a>
    <a href="#javascript">JavaScript</a>
    <a href="#jquery">jQuery</a>
</div>


Now just having this when we click on the navigation it should take us down to our desired location.
The CSS

Nothing to Crazy here. The most important part is the navigation. The position:fixed attribute keeps it at the top. And the margin top on the section class just make sure the content isn’t below the navigation when first loading the page.



<style>

/* Made the container thin
so I didn't have to come up
with too much content */
.container{
    width:300px;
    margin:0 auto;
  
}
/* So the sections don't fall
underneath the navigation */
.section{
    margin-top:60px;
}
/*
1. Keeps the position at the top of the page.
2. Adds a background so you can't see text
   underneath the nav.
3. Adds a little padding for breathing room.
*/
.navigation{
    position: fixed;
    background:white;
    padding:20px 20px;
    width:100%;
    margin-top:0px;
    top:0px;
}
</style>



The jQuery (aka The Magic behind smooth scrolling)

The jQuery isn’t overly complicated. We’re just going to use the animate function to a specific location over time. Now we get that location by referencing the item that has the id that the href of our navigation points to. So if our navigation points to “#css”, then we’ll get the position of the item that has the id of “css”


<script>
$(document).ready(function() {

    // Click event for any anchor tag that's href starts with #
    $('a[href^="#"]').click(function(event) {

        // The id of the section we want to go to.
        var id = $(this).attr("href");

        // An offset to push the content down from the top.
        var offset = 60;

        // Our scroll target : the top position of the
        // section that has the id referenced by our href.
        var target = $(id).offset().top - offset;

        // The magic...smooth scrollin' goodness.
        $('html, body').animate({scrollTop:target}, 500);

        //prevent the page from jumping down to our section.
        event.preventDefault();
    });
});
</script>



-----------------------------------------------------------------------------------------------
Putting it all together

Here is everything all in one.


Enjoy ! :)




<!DOCTYPE HTML>
<html>
<head>

<meta charset="UTF-8">
<title>Smooth Scrolling</title>
<style>

/* Made the container thin
so I didn't have to come up
with too much content */
.container{
    width:300px;
    margin:0 auto;
 
}
/* So the sections don't fall
underneath the navigation */
.section{
    margin-top:60px;
}
/*
1. Keeps the position at the top of the page.
2. Adds a background so you can't see text
   underneath the nav.
3. Adds a little padding for breathing room.
*/
.navigation{
    position: fixed;
    background:white;
    padding:20px 20px;
    width:100%;
    margin-top:0px;
    top:0px;
}
</style>
</head>

<body>
<div class="container">
    <div class="navigation">
        <a href="#html">HTML</a>
        <a href="#css">CSS</a>
        <a href="#php">PHP</a>
        <a href="#javascript">JavaScript</a>
        <a href="#jquery">jQuery</a>
    </div>
    <div class="section">
        <h1 id="html">HTML</h1>
        <p><!--Your HTML Content Goes HERE --></p>
    </div>
    <div class="section">
        <h1 id="css">CSS</h1>
        <p><!--Your HTML Content Goes HERE --></p>
    </div>
    <div class="section">
        <h1 id="php">PHP</h1>
        <p><!--Your HTML Content Goes HERE --></p>
    </div>
    <div class="section">
        <h1 id="javascript">JavaScript</h1>
        <p><!--Your HTML Content Goes HERE --></p>
    </div>
    <div class="section">
        <h1 id="jquery">jQuery</h1>
        <p><!--Your HTML Content Goes HERE --></p>
    </div>
</div>

<script>
$(document).ready(function() {

    // Click event for any anchor tag that's href starts with #
    $('a[href^="#"]').click(function(event) {

        // The id of the section we want to go to.
        var id = $(this).attr("href");

        // An offset to push the content down from the top.
        var offset = 60;

        // Our scroll target : the top position of the
        // section that has the id referenced by our href.
        var target = $(id).offset().top - offset;

        // The magic...smooth scrollin' goodness.
        $('html, body').animate({scrollTop:target}, 500);

        //prevent the page from jumping down to our section.
        event.preventDefault();
    });
});
</script>

</body>
</html>

-----------------------------------------------------------------------------------------------



See Demo | Download Source Files







Monday, January 9, 2012

Sliding Jquery Menu


Hi there welcome to another tutorial, in this tutorial il show you how to create a sliding menu button using jquery. You can see the effect in action over on the PSDtuts webpage in the top right hand corner.




Oh yes and before i forget you can download the source files for free using the button above.




When the button is clicked it rolls out a box full of links, when the button is clicked again it rolls back in. This can be done using jquery and in this tutorial il show you how to do it. Right lets get started, firstly lets get our button done out the way so we can then focus on the code. Open up photoshop and create a new document with your desired size of button, your button can be any size your wish. Im using a size of 182 x 32 pixels, double click your background layer and add a simple gradient overlay.




On the right hand side of your button add a little white arrow and a vertical divider. The divide consists of two colors #302f2f & #252525.




On the left side add your little icon and some text, i dont think i need to go into too much detail on the button design, as you’ll make your own to suit your own site. Heres how mine looks. (save your button image into your images folder)



Now for the exciting bit open up notepad and save a blank notepad document as styles.css, save the file into a folder called sliding menu on your desktop. Once saved close notepad, open up your folder “sliding menu” create two new folders one called js and another called images. Goto the main jquery webpage and download the jquery libary “jquery-1.3.1.min.js” rename the file to just “jquery” and stick it into the folder js. Open up dreamweaver and create a new HTML file save the file straight away inside your sliding menu folder. (filename for the HTML file doesnt matter call it what you like, sliding_menu.html might be a good idea.) Now your in dreamweaver click the code view tab.


The most import thing we need to do first is reference our javascript and css files we do this by typing this chunk of code within the “HEAD TAGS”.


  • <link href="style.css" rel="stylesheet" type="text/css" />
  • <script type="text/javascript" src="js/jquery.js"></script>
  • <script type="text/javascript" src="js/slider.js"></script>
You will notice there are 3 files we have referenced styles.css, jquery.js and a third slider.js (but i havent got a slider.js file i hear you cry.) We need to create that now, open up notepad and save a blank notepad document as slider.js, save it inside your js folder. Open up your slider.js file inside dreamweaver and type out the code below.

$(document).ready(function () {
    $('img.menu_class').click(function () {
    $('ul.the_menu').slideToggle('medium');
    });
});

Let me explain the code above the 1st line means when the document is loaded run the function in our case the sliding menu. The next line means once an image with a class of menu_class is clicked the menu will slide which brings me down to line 3. The menu will toggle down at a medium speed. You can change the speed if you wish from slow, medium or fast. The second and third line are important as they hold key elements refering to our CSS file which is img.menu_class and ul.the_menu. We havent wrote these yet but will do when we begin to write out our menu. Head over to your HTML in the code view so we can begin to write out our menu.

<img src="images/button.png" width="184" height="32" class="menu_class" />
<ul class="the_menu">
<li><a href="#">A Website #1</a></li>
<li><a href="#">A Website #2</a></li>
<li><a href="#">A Link #1</a></li>
<li><a href="#">A Link #2</a></li>
<li><a href="#">A Website #3</a></li>
<li><a href="#">A Website #4</a></li>
<li><a href="#">A Link #3</a></li>
<li><a href="#">A Link #4</a></li>
</ul>

The first bit of code you see is a simple image which is our button, we specify the width and height of our button we also give it a class. The class will be the images unique anchor point for the js file which we have already wrote. The class also lets us apply any styles via css using the class .menu_class. After that we have a simple unordered list. If we take alook at our menu in our browser this is how it looks.


Open up your CSS file in dreamweaver. Lets set a few style for the main part of our document.

body {
    font-family:Arial, Helvetica, sans-serif;
    font-size:12px;
    background-color: #333333;
}
Just some simple text and background styling is needed, set your font family and desired font size, ive also changed the background from white to a darkish grey color. The next bit of styling were going to add is for the ordered and unordered lists, were also going to apply a border to our button image, you may do your border in photoshop on the actual image but i find it best to add it using CSS as changing abit of code is easier then opening up photoshop to change it.

ul, li {
    margin:0;
    padding:0;
    list-style:none;
}
 
.menu_class {
    border:1px solid #1c1c1c;
}
The next bit of css styling refers to the menu that drops down once the button is clicked.

.the_menu {
    display:none;
    width:300px;
    border: 1px solid #1c1c1c;
}
In these styles you can change the width of the open menu, mine has a width of 300px but this can be what ever you like. Ive also given it a 1px border the same as our button. The next bit of styling refers to the background color of our rolled out navigation and also the text colors, sizes and hovers.

.the_menu li {
    background-color: #302f2f;
}
 
.the_menu li a {
    color:#FFFFFF;
    text-decoration:none;
    padding:10px;
    display:block;
}
 
.the_menu li a:hover {
    padding:10px;
    font-weight:bold;
    color: #F00880;
}

The_menu li is the color of the background when the navigation is rolled out, the text in the navigation links wont have any line underneath them as we have used text-decoration:none, we have also spaced out our links by adding 10px paddinig all the way around our links we also want to display the links in a block. The hover styles are pretty simple, padding the same as the last style, font weight bold = bold text and the color changed to a pinkish color. Thats it for the styles you menu should be ready to test. Heres mine.

Just a quick point on positioning, dont use div align to center or right align your button as the rollout will not be aligned up properly, if you want to align your menu button properly wrap it in its own div and position div how you see fit.

See what you can come up with, maybe add some icons to your list objects. Thanks for reading, dont forget to subscribe VIA rss and twitter.




Tuesday, January 3, 2012

'सोए तो पत्थर बन जाओगे' की अफवाह से नहीं सोए लोग

कानपुर।। गणेश जी के दूध पीने जैसी अफवाह के कई सालों बाद एक और अफवाह ने लोगों की नींद हराम किए रखी। कानपुर और उसके आसपास के इलाकों में रात दो बजे के बाद तक लोग अपने-अपने घरों के बाहर खड़े रहे। लोगों के बीच अफवाह यह थी कि 'जो आज रात को सोया वह पत्थर बन जाएगा।' इस अफवाह के साथ कहीं-कहीं यह अफवाह भी थी कि सुबह भूकंप आने वाला है और कहीं यह अफवाह थी कि कई गांवों में जमीन में धंस गई है।

जिला प्रशासन भी इन अफवाहों को लेकर काफी परेशान रहा। कानपुर पुलिस के डीआईजी राजेश राय ने बताया कि सोमवार रात दो बजे के बाद अचानक लोगों के मोबाइल पर यह मेसेज आने लगे कि अगर आज रात को सोए तो पत्थर बन जाओगे।

इसके बाद डर की वजह से लोग आने अपने घरों से निकल कर सड़कों पर आ गए और एक-दूसरे से पूछताछ करने लगे। जैसे ही यह खबर पुलिस के आला अधिकारियों के पास पहुंची, उन्होंने किसी अप्रिय घटना से बचने के लिए सड़कों पर गश्त तेज करवा दी।

रात 3 बजे के बाद तो सड़कों और चौराहों पर लोगों का भारी हुजूम जमा हो गया था और लोग एक-दूसरे से इस अफवाह के बारे में पूछताछ कर रहे थे। डीआईजी ने कहा, 'उन्होंने इस बारे में जानकारी ली तो कुछ लोगो ने उन्हें बताया कि उनके पास सोने पर पत्थर हो जाने की अफवाह के फोन उन्नाव और हरदोई जिलों से आए लेकिन सही-सही इस बात का पता न चल सका कि आखिर यह अफवाह उड़ी कैसे।

अफवाहों का आलम यह था कि महिलाएं अपने घरों में पूजा-पाठ करने लगीं और मुस्लिम समाज के लोगों ने मस्जिदों का रुख कर लिया और वहां बैठ कर दुआएं मांगने लगे। शहर के चमनगंज, पी रोड, नवाबगंज, ग्वालटोली, बेकनगंज, किदवईनगर, गोविंद नगर जैसे दर्जनों मोहल्लों में सुबह तक लोगों की भारी भीड़ सड़कों पर जमा रही।

डीआईजी राय ने लोगों से किसी भी तरह की अफवाह पर ध्यान नहीं देने और बहकावे में न आने की अपील की है।

उधर पड़ोसी जिले उन्नाव के संवाददाता के अनुसार वहां भी सोने पर पत्थर का इंसान होने की अफवाहों के कारण रात दो बजे के आसपास लोग सड़कों पर निकल आए। वहां कुछ जगह पर यह भी अफवाह थी कि सुबह बहुत विनाशकारी भूकंप आने वाला है। इस डर से भी सुबह तक लोग अपने अपने घरों के बाहर जमे रहे और किसी गंभीर घटना के डर से सहमे रहे।

उन्नाव और उसके आसपास शुक्लागंज पुरवा में महिलाओं ने इस अफवाह के डर से अपने घरों में पूजा पाठ शुरू कर दिया। इसी तरह कानपुर के ग्रामीण इलाकों में भी अफवाह फैली थी कि इलाके के कुछ गांव जमीन में धंस गए हैं जिसको लेकर काफी दहशत बनी रही और लोग एक दूसरे को फोन कर इस खबर की पुष्टि करते रहे। जिन लोगों के रिश्तेदार दिल्ली जैसे महानगरों में रहते थे, वहां पर भी लोगों ने फोन करके खैरियत पूछी।

इन अफवाहों से सबसे ज्यादा परेशान पुलिस और प्रशासनिक अधिकारियों के अलावा पत्रकार रहे जिनके पास इन अफवाहों की पुष्टि के लिए रात दो बजे से सुबह पांच बजे तक लगातार फोन आते रहे लेकिन दिन निकलने के साथ ही यह स्पष्ट हो गया कि यह केवल अफवाह थी। डीआईजी राय कहते है कि चिंता की बात तो यह है कि आखिर यह अफवाह फैली कहां से और कैसे।