Tag: html5

javascript slowly decrease volume of audio element

audio element is playing with volume: audio.setVolume(.20) At a certain point I want to fade out the volume, rather than have it cut abruptly, so in essence I want audio.setVolume(.15) audio.setVolume(.10) audio.setVolume(.05) audio.setVolume(.03) audio.setVolume(.01) but there needs to be some very brief delay in between these changes so they are audible and I get my […]

center floating div horizontally

I want a horizontally centered “floating” div, i.e. one that always is on top of the screen even if the user scrolls around. With the following CSS I get the div centered completely on the left: #guiBar { margin-left: auto; margin-right: auto; position: fixed; } margin: 0 auto doesn’t help either (presumably because that doesn’t […]

Is it possible to have two divs inside a div, one docked left and one right, such that one shrinks when space is unavailable?

I am making a web application with a panel. Inside this panel I want to have a constant-size button on the left, and some status text on the right. When the window shrinks, I want the text that is docked on the right to shrink to accommodate everything. Example: Initial: [[BUTTON] [Status text]] When shrunk: […]

Validation for 10 digit mobile number and focus input field on invalid

I need the code for validating email and mobile number in jQuery and also focus() on that particular field where validations are not satisfied. This is my query <form name=”enquiry_form” method=”post” id=”enquiry_form”> Full Name * <input class=”input-style” name=”name” id=”name” type=”text” required> Email * <input class=”input-style” name=”email” id=”email” type=”email” required> Phone * <input name=”mobile” id=”mobile” type=”number” […]

Create new HTML5 video element throught JavaScript

I am trying to create a new HTML5 video elemnt entirely throught JS. So I try to do it the same way I create a new image, like: obj = new Image() I write obj = new HTMLVideoElement(). However this doesn’t work. I get the runtime error: Object doesn’t support this action. What is wrong? […]

Quota exceeded trying to create file with HTML File API

In a packaged Chrome app, I’m trying to read from a file in the PERSISTENT storage, and create it if it doesn’t exist: window.webkitRequestFileSystem(PERSISTENT, 1024*1024, function(fileSystem) { fileSystem.root.getFile(‘file.txt’, {create: true}, function(fileEntry) { fileEntry.file(function(file) { var reader = new FileReader(); reader.onloadend = function(e) { console.log(this.result); }; reader.readAsText(file); }, errorHandler); }, errorHandler); }); But I’m getting The […]

How to clear the value of a kendo Combo Box

I’m fairly new to kendo.I have a requirement to load child combo box data from parent combo box also while I change values it sholud clear the value of existing with child combo and fill with a relevant value. if someone can guide me to achieve this that would be great. Thanks Chinthaka

mouse events to touch event for ipad compatibility

i have this kids painting app which uses mouse events to paint on an image. However i need to convert mouse events to touch so that it could work on an ipad. Please can someone explain me how to do this. My app code is quite similar to this sample code http://cool-php-tutorials.blogspot.co.uk/2011/05/simple-html5-drawing-app-with-saving.html. P.S my knowledge […]

Simple ternary operator not working

I don’t know why this simple ternary operator doesn’t work. var numOne = prompt(“Enter first number”); var numTwo = prompt(“Enter second number”); var outcome = numOne > numTwo ? “First number is bigger” : “Second number is bigger”; document.getElementById(“paragraph”).innerHTML(outcome);

HTML5 – delay canvas drawing

I have a simple chunk of code to draw a line in a page. My problem is that I don’t know much about HTML5 or JS and I need help to set a delay on the drawing of this line. I want to be able to choose if I want to see it drawing instantly […]