Wednesday, July 23, 2014

CSS3 transition-timing-function Property

Transition-timing-function property is new CSS3 property.It specifies the speed curve of the transition effect.A transition effect with same speed from start to end.


Syntax

transition-timing-function: ease|linear|ease-in|ease-out|ease-in-out|cubic-bezier()|initial|inherit;

CSS3 Code for transition

div {
        -webkit-transition-timing-function: linear; /* Safari and Chrome */
        transition-timing-function: linear;
        }

Browser Support

The transition-timing-function property is supported in Internet Explorer 10, Firefox, Opera, and Chrome.

Please share your comments and feedback.Thanks.Please subscribe my updates via email.

CSS3 counter-increment Property

Counter-increment property is new CSS3 property.The counter-increment is used to increments one or more counter values.

Syntax

counter-increment: none|id|initial|inherit; 


Simple CSS3 Code for Counter-increment

h2::before {
        content: counter(section) ". ";
        counter-increment: section;
    }

Full CSS3 Code for Counter-increment

<style type="text/css">
h1 {
    counter-reset: section;
}
h2 {
    counter-reset: subsection;
}
h2::before {
    content: counter(section) ". ";
    counter-increment: section;
}
p::before {
    content: counter(section) "." counter(subsection) " ";
    counter-increment: subsection;
}
</style>

Browser Support

The counter-increment property is supported in all major browsers.
Please share your comments and feedback.Thanks.Please subscribe my updates via email.

Tuesday, July 22, 2014

HTML5 reversed Attribute

HTML5 <ol> reversed Attribute is new attribute in HTML5.It specifies that the list order should be descending (9,8,7...), instead of ascending (1, 2, 3...).

Syntax

<ol reversed>

Simple Example

<ol reversed>
            <li>Java</li>
            <li>HTML5</li>
            <li>PHP</li>
            <li>CSS3</li>
            <li>Joomla</li>
            <li>Wordpress</li>
            <li>Magento</li>
            <li>Opencart</li>
            <li>Core Commerce</li>
            <li>Ruby</li>
        </ol>

HTML5 also contains start attribute.If you specify start="50" then the listing items will starting with 50.

HTML5 reversed Attribute

<ol reversed="reversed" start="50">
           <li>Java</li>
            <li>HTML5</li>
            <li>PHP</li>
            <li>CSS3</li>
            <li>Joomla</li>
        </ol>

Please share your comments and feedback.Thanks.Please subscribe my updates via email.

Monday, July 21, 2014

Display alexa rank in your website using php

This is very simple php scipt,it is used to display your website alexa rank in website.


Live DemoDownload Script


Replace url="your website url".
file_get_contents is used to read a file into a string.

Php alexa rank Code

<?php $url = file_get_contents('http://data.alexa.com/data?cli=10&dat=snbamz&url=http://codeinnovators.blogspot.in/'); ?>

Full Source Code

<?php

        $url = file_get_contents('http://data.alexa.com/data?cli=10&dat=snbamz&url=http://codeinnovators.blogspot.in/');
      
        //Alexa Rank
        preg_match('/\<popularity url\="(.*?)" text\="([0-9]+)" source\="panel"\/\>/si', $url, $matches);
        $globalrank = ($matches[2]) ? $matches[2] : 0;
       
        //Alexa Sites Linking in
        preg_match('/\<linksin num\="([0-9]+)"\/\>/si', $url, $cocok);
        $alexabacklinks = ($cocok[1]) ? $cocok[1] : 0;
       
        echo "Global Rank : ".$globalrank;
        echo "<br>";
        echo "Alexa Backlinks : ".$alexabacklinks;
        ?>
 
Please share your comments and feedback.Thanks.Please subscribe my updates via email.

Friday, July 18, 2014

Javascript empty function

In this article i am going to show how to clear contents in web page.Empty() is used remove the content of all particular elements like <div>,<p> etc.



Live DemoDownload Script


Step 1:
Need library file to perform empty action.Please copy and Paste below library file.
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>

jQuery Empty Function

<script>
        $(document).ready(function(){
          $("#removebtn").click(function(){ //button id
            $("#para").empty(); //div id
          });
        });
        </script>

HTML code for Javascript event

<div id="para" style="border:1px solid #ccc;height:160px;width:400px; padding:5px;"> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining</div>
<button id="removebtn" style="background:#0099FF; border:none; height:25px; margin:5px; color:#fff; cursor:pointer">Run Empty Method</button>

Please share your comments and feedback.Thanks.Please subscribe my updates via email.

Thursday, July 17, 2014

Shake effect using CSS3

CSS Keyframes are used to create animations.There are many CSS3 animation methods available.In this article i am going to show how to add shake effect for text.



CSS3 animation

/*for webkit browsers*/
@-webkit-keyframes shake {
    0% { -webkit-transform: translate(0px); }
    20% { -webkit-transform: translate(10px); }
    40% { -webkit-transform: translate(-10px); }
    51% { -webkit-transform: translate(6px); }
    70% { -webkit-transform: translate(-6px); }
    90% { -webkit-transform: translate(3px); }
    100% { -webkit-transform: translate(0px); }
}
/*for mozilla browser*/
@-moz-keyframes shake {
    0% { -moz-transform: translate(0px); }
    20% { -moz-transform: translate(10px); }
    40% { -moz-transform: translate(-10px); }
    51% { -moz-transform: translate(6px); }
    70% { -moz-transform: translate(-6px); }
    90% { -moz-transform: translate(3px); }
    100% { -moz-transform: translate(0px); }
}
.shake:hover {
    -webkit-animation: shake 0.7s;/*for webkit browsers*/
    -moz-animation: shake 0.7s;/*for mozilla browser*/
}

HTML code for disable right click

 <p class="shake">Codeinnovators</p>

The class name is used to set which animation you want.
Please share your comments and feedback.Thanks.Please subscribe my updates via email.

Submit a form without refreshing page using ajax and PHP

This is very simple function.Ajax is used to submit a form without refreshing page.




Live DemoDownload Script


Step 1:
    Need library function.Just copy and paste the below library file.
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>

jQuery Code

<script type="text/javascript" >
    $(function() {
        $(".submit").click(function() {
        var name = $("#name").val();
        var email = $("#email").val();
        var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
      
        var dataString = 'name='+ name + '&email=' + email;
       
        if(name=='')
        {
            $('.success').fadeOut(200).hide();
            $('.error').fadeOut(200).show().html('<div class="notice" align="left">Please enter a name</div>');;
            $("#name").focus();
        }
        else if(email=='')
        {
            $('.success').fadeOut(200).hide();
            $('.error').fadeOut(200).show().html('<div class="notice" align="left">Please enter a email address</div>');;
            $("#email").focus();
        }
        else if(reg.test(email) == false)
          {
                $('.success').fadeOut(200).hide();
                $('.error').fadeOut(200).show().html('<div class="notice" align="left">Please enter a valid email address</div>');;
                $("#email").focus();
          }
        else
        {
            $.ajax({
                type: "POST",
                url: "mail.php",
                data: dataString,
                success: function(){
                $('.success').fadeIn(200).show();
                $('.error').fadeOut(200).hide();
            }
            });
        }
        return false;
        });
    });
    </script>

HTML form

<form method="post" name="form">
  <p>Name:
    <input id="name" name="name" type="text" />
  </p>
  <p>Email:
    <input id="email" name="email" type="email" required />
  </p>
  <span class="error" style="display:none; color:#FF0000"> Please enter valid data</span> <span class="success" style="display:none;color:#33CC66"> Thank You.Your mail has been sent successfully.</span>
  <p>
    <input type="submit" name="submit" value="Submit" class="submit"/>
  </p>
</form>

Please share your comments and feedback.Thanks.Please subscribe my updates via email.