Home

Showing posts with label HTML. Show all posts
Showing posts with label HTML. Show all posts

Tuesday, April 15, 2014

Using Videos as Backgrounds with Responsive

<style>
body {
    margin: 0;
    padding: 0;   
}
#container {
    position: relative;
    overflow: hidden;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script>
$(function() {
   
    // IE detect
    function iedetect(v) {

        var r = RegExp('msie' + (!isNaN(v) ? ('\\s' + v) : ''), 'i');
        return r.test(navigator.userAgent);
           
    }

    // For mobile screens, just show an image called 'poster.jpg'. Mobile
    // screens don't support autoplaying videos, or for IE.
    if(screen.width < 800 || iedetect(8) || iedetect(7) || 'ontouchstart' in window) {
   
        (adjSize = function() { // Create function called adjSize
           
            $width = $(window).width(); // Width of the screen
            $height = $(window).height(); // Height of the screen
           
            // Resize image accordingly
            $('#container').css({
                'background-image' : 'url(poster.jpg)',
                'background-size' : 'cover',
                'width' : $width+'px',
                'height' : $height+'px'
            });
           
            // Hide video
            $('video').hide();
           
        })(); // Run instantly
       
        // Run on resize too
        $(window).resize(adjSize);
    }
    else {

        // Wait until the video meta data has loaded
        $('#container video').on('loadedmetadata', function() {
           
            var $width, $height, // Width and height of screen
                $vidwidth = this.videoWidth, // Width of video (actual width)
                $vidheight = this.videoHeight, // Height of video (actual height)
                $aspectRatio = $vidwidth / $vidheight;
               
                       
            (adjSize = function() { // Create function called adjSize
                           
                $width = $(window).width(); // Width of the screen
                $height = $(window).height(); // Height of the screen
                           
                $boxRatio = $width / $height; // The ratio the screen is in
                           
                $adjRatio = $aspectRatio / $boxRatio; // The ratio of the video divided by the screen size
                           
                // Set the container to be the width and height of the screen
                $('#container').css({'width' : $width+'px', 'height' : $height+'px'});
                           
                if($boxRatio < $aspectRatio) { // If the screen ratio is less than the aspect ratio..
                    // Set the width of the video to the screen size multiplied by $adjRatio
                    $vid = $('#container video').css({'width' : $width*$adjRatio+'px'});
                } else {
                    // Else just set the video to the width of the screen/container
                    $vid = $('#container video').css({'width' : $width+'px'});
                }
                               
            })(); // Run function immediately
                       
            // Run function also on window resize.
            $(window).resize(adjSize);
                       
        });
    }
   
});
</script>
<body>
<div id="container">
    <video autoplay loop muted>
        <source src="video.mp4" type="video/mp4">       
    </video>   
</div>

Friday, February 22, 2013

How to type in Hindi or Gujarati language in text box

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>How to type in Hindi or Gujarati language in text box</title>  
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      // Load the Google Transliterate API
      google.load("elements", "1", {
            packages: "transliteration"
          });
      function onLoad() {   
var options = {
          sourceLanguage: 'en',
          destinationLanguage: ['gu'],        
          transliterationEnabled: true
        };  
     
var control = new google.elements.transliteration.TransliterationControl(options);
var ids = [ "first_name", "last_name" ];
control.makeTransliteratable(ids);
      }
      google.setOnLoadCallback(onLoad);
    </script>
</head>
Working Demo :
    <table width="50%" style="border:1px solid #06F;background-color:#CFC">
    <tR>
        <td>પહેલું નામ :</td>
            <Td><input type="text" name="first_name" id="first_name"></Td>
        </tR>
        <tR>
        <td>અટક :</td>
            <Td><input type="text" name="last_name" id="last_name"></Td>
        </tR>
    </table>
How to type in Hindi or Gujarati language in text box Working Demo :
પહેલું નામ :
અટક :

Saturday, December 29, 2012

How can I overlay a div with semi-transparent opacity over a youtube iframe embedded video?

How can I overlay a div with semi-transparent opacity over a 
youtube iframe embedded video?
 
<iframe type="text/html"  
    src="http://www.youtube.com/embed/NWHfY_lvKIQ">
</iframe> 
 
Make sure its the first parameter in the URL. Other parameters must go after
  
Example :
<iframe type="text/html"   
  src="http://www.youtube.com/embed/NWHfY_lvKIQ?wmode=opaque">
</iframe>
 

Friday, January 27, 2012

Holding the mouse over this marquee stops it from scrolling.

<marquee title="Holding your cursor over this stops the marquee."
            ONMOUSEOVER="this.stop();"
            ONMOUSEOUT="this.start();">
         <H3>Test Marquee</H3>
         <P>Holding the mouse over this marquee stops it from scrolling.</P>
</MARQUEE>

Tuesday, July 19, 2011

How to Get Parameters Values in HTML with Javascript

<a href="get.html?name=Dhirendra">Test</a>
<SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">

function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}
var frank_param = gup( 'name' );
//alert(frank_param);
document.write(frank_param);
</script>
rathoddhirendra.blogspot.com-Google pagerank and Worth