Header menu


Wednesday, 5 March 2014

How to create Fixed left sidebar in html ?

To create a fixed left sidebar in html we need to make its position fixed in css and float left so that sidebar remain left aligned.


These two lines will do the magic for you. To understand more run the below example:


                                 .left-sidebar p {
                                                        border:1px solid;
                                                        margin-left: 205px;
           <div class='left-sidebar' id='left-sidebar'>
                            <li id='li-banner'>Banners</li>
                            <li id='li-banner1'>Banners</li>
                           <li id='li-banner2'>Banners</li
             <div id='container' class='container1'>
                      <h1>My Left Side bar is fixed.</h1>
                      <h1>Its not gonna move :)</h1>

Monday, 3 March 2014

Highlight/Blink effect using jquery

We often use blink in html to get users attention but it makes our info unreadable and irritating. So today i am sharing a small jquery code which will produce same effect. And can be easily edit according to need.

 function blink(){
      $("#box").fadeTo(100, 0.1).fadeTo(200, 1.0);

This is small code which can do the whole thing work. Self.setInterval() is function which will call itself after 1 sec and call blink function. 

For more details run the below example : 

Saturday, 1 March 2014

Iteration through array with delay in jquery

What my problem is I have an array and i have to pass array element to some function with some delay between each call. Now if i iterate using loop the iteration has already been completed before calling function and i am only able to pass last value of my array to function. To deal with this i found a way using recursion such that there is delay between my each call to function.

Now in my example :
l is length of array
arr is array
k is index
tex is my function i am calling


 var k=0;
 var arr=[1,2,3,4,5,6,7,8];
 function tex(arr,k,l){

                                 setTimeout(function() { k++; tex(arr,k,l); },3000);

This is basic structure of code and it will call tex() after each 3 sec and tex will alert array elements one by one.

To understand more run below example: