Friday, November 28, 2014

CSS3 Spin Animation

<style type="text/css">

div {
    margin: 20px;
    width: 100px;
    height: 100px;
    background: #33b5e5;
    -webkit-animation-name: spin;
    -webkit-animation-duration: 4000ms;
    -webkit-animation-iteration-count: infinite;
    -webkit-animation-timing-function: linear;
    -moz-animation-name: spin;
    -moz-animation-duration: 4000ms;
    -moz-animation-iteration-count: infinite;
    -moz-animation-timing-function: linear;
    -ms-animation-name: spin;
    -ms-animation-duration: 4000ms;
    -ms-animation-iteration-count: infinite;
    -ms-animation-timing-function: linear;
 
    animation-name: spin;
    animation-duration: 4000ms;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
}
@-ms-keyframes spin {
    from { -ms-transform: rotate(0deg); }
    to { -ms-transform: rotate(360deg); }
}
@-moz-keyframes spin {
    from { -moz-transform: rotate(0deg); }
    to { -moz-transform: rotate(360deg); }
}
@-webkit-keyframes spin {
    from { -webkit-transform: rotate(0deg); }
    to { -webkit-transform: rotate(360deg); }
}
@keyframes spin {
    from {
        transform:rotate(0deg);
    }
    to {
        transform:rotate(360deg);
    }
}

</style>

<div></div>


Output :)

1)

2)

Wednesday, November 26, 2014

JQuery : Scroll to nth row in a table.

<style type="text/css">

table{margin-top:20px;}

td{padding:3px;}

td:nth-child(1){color:red;}

tr.active{background-color:yellow;}

#control{
line-height:20px;
padding:3px;
position:fixed;
top:0;left:0;right:0;
background-color:#33b5e5;
}

</style>

<script type="text/javascript" src="jquery-1.11.1.min.js"></script> /* Link jQuery file here.. */


<div id="control">
    Line <input type="text" size="5" id="line" /> <button> go </button>
</div>
<table>
    <tr>
        <td></td>
        <td></td>
    </tr>
</table>


<script type="text/javascript">

// create and fill the table
var row = $('tr');
var table = $('table');

for (var i=1;i<100;i++){
   row.clone().appendTo( table );
}

table.find('tr').each(function(idx, elem){
   $(this).find('td:first').text(idx).end().find('td:last').text('This is the line '+(idx)+' of the table');
});

// code to scroll
$('#control button').click(function(){
   var w = $(window);
   var row = table.find('tr')
       .removeClass('active')
       .eq( +$('#line').val() )
       .addClass('active');
 
   if (row.length){
       w.scrollTop( row.offset().top - (w.height()/2) );
   }
});

</script>


Output :)

1)

2)

Monday, November 24, 2014

How to blink a div using jquery ?

<style type="text/css">

.blink{
width: 250px;
padding: 5px;
background: red;
text-align: center;
color: white;
font-weight: bold;
font-size: 25px;
font-family: comic sans ms;
border-radius: 10px;
}

.nblink{
font-family: verdana;
font-weight: bold;
font-size: 27px;
padding-left: 20px;
}

</style>

<script type="text/javascript" src="jquery-1.11.1.min.js"></script> //Attach jQuery file here

<div class="blink">Blinking text</div>
<span class="nblink">Non-Blinking</span>
<div class="blink">Blinking text</div>

<script type="text/javascript">

function blink(selector){
$(selector).fadeOut('slow', function(){
   $(this).fadeIn('slow', function(){
       blink(this);
   });
});
}
 
blink('.blink');

</script>

Output :)

1)

2)

Thursday, November 20, 2014

Play multiple CSS animations at the same time.

<style type="text/css">

.image {
border-radius: 25%;
   -webkit-animation: spin 2s linear infinite;
}

.container {
   position: absolute;
   top: 40%;
   left: 50%;
   margin:-60px 0 0 -60px;
   -webkit-animation: scale 4s linear infinite;
}

@-webkit-keyframes spin {
   100% {
       transform: rotate(180deg);
   }
}

@-webkit-keyframes scale {
   100% {
        transform: scale(2);
   }
}

</style>


<div class="container">
<img class="image" src="p17.png" alt="" width="170" height="170"/>
</div>


Output :)

1)

2)

3)

Tuesday, November 18, 2014

CSS translate child when parent is hovered

<style type="text/css">

.slidebutton {
display:inline-block;
text-align:center;
padding:16px 30px;
font-family: verdana;
font-size: 25px;
border:1px solid #33b5e5;
position:relative;
cursor:pointer;
}

.slidebutton>.background {
position:absolute;
top:100%;
left:0%;
width:100%;
height:100%;
background-color:#33b5e5;
-webkit-transition: 0.2s ease-in-out;
-moz-transition: 0.2s ease-in-out;
-o-transition: 0.2s ease-in-out;
transition: 0.2s ease-in-out;
}

.slidebutton:hover>.background {
-webkit-transform: translate(0%,-100%);
-moz-transform: translate(0%,-100%);
-o-transform: translate(0%,-100%);
-ms-transform: translate(0%,-100%);
transform: translate(0%,-100%);
}

</style>

<div class="slidebutton">
    <div class="background"></div>
    <div class="text">MaHi</div>
</div>


Output :)

1)

2)

Monday, November 17, 2014

Hover a whole element to show details in CSS

<style type="text/css">

.portfolio-web
{
    background: #f5f5f5;
    padding: 20px 0;
}
.portfolio-container
{
    margin: 40px 0;
}
.portfolio-tagline
{
    font-family: 'Oswald', Arial, sans-serif;
    font-size: 3em;
    font-weight: 400;
    text-transform: uppercase;
    text-align: center;
    margin: 30px 0;
}
.portfolio-item
{
    background: white;
    width: 100%;
    height: 280px;
    margin-top: 20px;
    overflow: hidden;
    position: relative;
    vertical-align: top;
}
.portfolio-image
{
    cursor: default;
}
.portfolio-image-one
{
    width: 100%;
    height: 200px;
}
.portfolio-info
{
    background: white;
    margin-top: 200px;
    position: absolute;
    left: 0;
    top: 0;
    height: 280px;
    text-align: center;
    text-decoration: none;
    transition: all 0.5s ease;
}
.portfolio-item:hover > .portfolio-info
{
    margin-top: 0;
    text-decoration: none;
}
.portfolio-logo-one
{
    width: 100%;
    height: 80px;
    vertical-align: middle;
}
.porfolio-brief-info
{
    color: #33b5e5;
    font: 20px 'Open Sans', Arial, sans-serif;
    margin: 0;
    padding: 10px;
    position: absolute;
}
.portfolio-info-link
{
    color: white;
    font: 14px 'Open Sans', Arial, sans-serif;
    padding: 10px;
    padding-top: 100px;
    font-weight: bold;
}

img{
    width: 400px;
    height: 400px;
}

</style>

<div class="col-lg-3">
    <div class="portfolio-item">
        <a class="portfolio-image" href="#">
            <div class="portfolio-image-one">
                <img src="wall.jpg" alt="Thumbnail" />
            </div>
        </a>
        <a class="portfolio-info" href="#">
            <div class="portfolio-logo-one">
                <img src="Rangoli.png" alt="Logo" />
            </div>
            <p class="porfolio-brief-info">
                Next Year My Rangoli Target...!!
            </p>

            <p class="portfolio-info-link">By: MaHii</p>
        </a>
    </div>
</div>


Output :)

1)

2)

Saturday, November 15, 2014

Blend Modes in CSS

1) CSS Difference Normal Backgrounds Blend Modes

<style type="text/css">

.bg-blend {
background-image: url("cls63.png");
background-color: #33b5e5;
background-blend-mode: Difference, Normal;
}

.normal-image {
background-image: url("cls63.png");
}

.just-color {
background: #33b5e5;
}

.exp > div {
float: left;
width: 250px;
height: 250px;
background-size: cover;
}

.exp {
width: 750px;
overflow: hidden;
}

</style>

<div class="exp">
<div class="just-color"></div>

<div class="normal-image"></div>

<div class="bg-blend"></div>
</div>

Output :)



2) CSS Multiple Backgrounds Blend Modes

<style type="text/css">

.bg-blend {
background-image: url("cls63.png");
background-color: #33b5e5;
background-blend-mode: multiply;
}

.normal-image {
background-image: url("cls63.png");
}

.just-color {
background: #33b5e5;
}

.exp > div {
float: left;
width: 250px;
height: 250px;
background-size: cover;
}

.exp {
width: 750px;
overflow: hidden;
}

</style>

<div class="exp">
<div class="just-color"></div>

<div class="normal-image"></div>

<div class="bg-blend"></div>
</div>

Output :)


Thursday, November 13, 2014

Popup DropDown Using jQuery.

I am using jQuery file in this example..

Ex :-)

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

<style type="text/css">

#container { background: #eee; margin: 20px; min-height: 300px; position: relative; }

#columns { position: absolute; top: 20px; left: 20px; padding: 8px; border-radius: 4px; border: 0px; background: #33b5e5; color: white; }

#selector { 
    position: absolute; 
    top: 60px; 
    left: 20px;
    background: #fff;
    border: 1px solid #999;
    border-radius: 5px;
    padding: 2px;
    font-size: 14px;
    color: #999;
    font-family: verdana;
    display: none;
}

#selector p{
margin: 5px;
}

</style>

<div id="container">
<button id="columns">Click on Me</button>
<div id="selector">
    <p><input type="checkbox"> MaHi</p>
    <p><input type="checkbox"> Sonal</p>    
    <p><input type="checkbox"> Aarti</p>
    <p><input type="checkbox"> Manisha</p>
</div>
</div>

<script type="text/javascript">

$(document).ready(function() {
    $('#columns').on('click', function() {
        $('#selector').fadeToggle(500);
    });
});

</script>


Output :)

1)

2)

Wednesday, November 12, 2014

Make two pictures overlap using CSS

<style type="text/css">

.container {
width: 550px;
height: 250px;
margin: 50px;
overflow:hidden;
position: relative;
border: 2px solid #666;
}

.img1 {
border-right: 2px solid #666;
position: absolute;
width: 325px;
height: 600px;
overflow: hidden;
left: -75px;
top: -230px;
z-index: 2;
-ms-transform: rotate(45deg); /* IE 9 */
-webkit-transform: rotate(45deg); /* Chrome, Safari, Opera */
transform: rotate(45deg);
}

.img1 img {
-ms-transform: rotate(-45deg); /* IE 9 */
-webkit-transform: rotate(-45deg); /* Chrome, Safari, Opera */
transform: rotate(-45deg);
}

.img2 {
position: absolute;
width: 450px;
left: 150px;
z-index: 1;
overflow: hidden;
}

</style>

<div class="container">
    <div class="img1"><img src="dubai evening rush.png" /></div>
    <div class="img2"><img src="dubai.jpg" /></div>
</div>


Output :)


Tuesday, November 11, 2014

Mask or clip of an image's shape using CSS

<style type="text/css">

.triangle{
border-radius: 50%;
width: 150px;
height: 150px;
margin: 50 auto;
transform: rotate(-45deg);
position: relative;
overflow:hidden;
border-radius: 0 50% 50% 50%;
}
.triangle img{
width: 200%;
height: 200%;
transform: rotate(45deg);
position: relative;
left: -90px;
top: -24px;
}

</style>

<body>
<div class="triangle">
 <img src="ganesha.jpg" />
</div>
</body>


Output :)


Sunday, November 9, 2014

Create triangle shaped pointer/border on a horizontal line.

<style type="text/css">

.box {
background: #33b5e5;
width: 500px;
height: 80px;
position: relative;
}

.line {
height: 39px;
border-bottom: 2px solid white;
}

.triangle {
background: #33b5e5;
border: 2px solid white;
border-width: 2px 2px 0 0;
transform: rotate(-45deg);
position: relative;
left: 250px;
top: 28px;
width: 20px;
height: 20px;
}

</style>

<div class="box">
<div class="line">
<div class="triangle"></div>
</div>
</div>


Output :)