Found 601 Articles for Front End Scripts

Detect area of a PNG that is not transparent with HTML

Lakshmi Srinivas
Updated on 29-Jan-2020 06:40:56

385 Views

To detect an area of a PNG that is not transparent: You need to first get the buffer You need to get 32-bits reference of that buffer Scan 0 widths to find x1 edge Scan width 0 to find x2 edge Height to find the y1 edge Height 0 to find the y2 edge

To “user-scalable=no” or not to “user-scalable=no” in HTML5

Rishi Rathor
Updated on 30-Jul-2019 22:30:22

175 Views

For responsive design, you do not have to use user-scalable=no. Use it only if you want your application to look more like a native app.Zooming is a key feature for accessibility and you need to keep that in mind. You can control that users won't break your design if they zoom in. If you are doing responsive and your design breaks when zooming in, then you're not doing it right.If you totally need to use it, then keep in mind that zooming is an important accessibility feature that is used by many people.

canvas.style.display = “block” not working in HTML5

karthikeya Boyini
Updated on 29-Jan-2020 06:40:33

179 Views

Change the setTimeout() to use a function reference. It works as the function available at the time the reference.The reference will be transferred to the timeout event callback rather than a string reference:window.setTimeout(startNow, 2000);Set it like the following:setTimeout(startNow, 1000); function startNow () {    alert(‘Working correctly!'); }

Draw Lines with easelJS using Ticker in HTML

Samual Sam
Updated on 29-Jan-2020 06:39:08

255 Views

EaseLJS is a JavaScript library to make the HTML5 Canvas element easy. Use it for creating games, graphics, etc.To draw lines using Ticker method in HTML with easeLJS:var myLine = new createjs.Shape(); myLine.graphics.setStrokeStyle(4); myLine.graphics.beginStroke(color); myLine.graphics.moveTo(startX, startY); startY++; myLine.graphics.lineTo(startX, startY); myLine.graphics.endStroke();

How can I write a form that assists my browser's auto-complete feature?

Krantik Chavan
Updated on 16-Jun-2020 13:30:18

78 Views

The official specification of HTML5 states:When the autofill field name is "on", the user agent should attempt to use heuristics to determine the most appropriate values to offer the user, e.g. based on the element's name value, the position of the element in the document's DOM,  whaUse any of the following as values for the autocomplete attribute:)Field NameMeaning"name"Full name"honoritic-prefix"Prefix or title (e.g. "Mr.", "Ms.", "Dr.", "M||e")"given-name"Given name (in some Western cultures, also known as first name"additional-name"Additional name (in some Western cultures, also know as middle name, forenames other than the first name)"family-name"Family name (in some Western cultures, also know as ... Read More

Play video on canvas and preserve the last frame/image on HTML5 Canvas

Lakshmi Srinivas
Updated on 29-Jan-2020 06:38:07

203 Views

You can try to run the following code to play and preserve the video’s last frame:var c = $('canvas')[0]; var context = canvas.getContext('2d'); c.width = 640; c.height = 480; $("#,myPlayer").on('play', function (e) {    var $this = this;    (function loop() {       if (!$this.paused && !$this.ended) {          context.drawImage($this, 0, 0, 640, 480);          setTimeout(loop, 1000 / 30);       }    })(); });

Get maximal GPS precision on mobile browser

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:22

174 Views

Built-in browser for Android will not give you accurate GPS location for security reasons. Test it with different web browsers that would need permissions to get the accurate location from GPS when installed.After switching GPS off, the data is received with < 10 meters accuracy.Do not use Android Browser for websites, if you want to get GPS location with high accuracy.50 meters precision can be seen for Safari browser if tested for iPhone with wifi switched off. Yes, the accuracy is lesser.

Retrofit existing web page with mobile CSS

karthikeya Boyini
Updated on 29-Jan-2020 06:37:40

98 Views

To retrofit, use the CSS media queries, and allow different stylesheets to different browser capabilities. A benefit is that you do not have to go for any server-side code.This would require you to add specific detection code to the script for grouping of the device.The media queries handle even devices you've never heard of.Set the following:@media handheld and (max-width: 480px), screen and (max-device-width: 480px), screen and (max-width: 600px) {    body {       color: blue;    } }

Frame by frame animation in HTML5 with canvas

Nishtha Thakur
Updated on 29-Jan-2020 06:36:50

620 Views

To create a frame by frame animation in HTML5 with canvas, try to run the following code:var myImageNum = 1; var lastImage = 5; var context = canvas.getContext('2d'); var img = new Image; img.onload = function(){    context.clearRect( 0, 0, context.canvas.width, context.canvas.height );    context.drawImage( img, 0, 0 ); }; var timer = setInterval( function(){    if (myImageNum > lastImage){       clearInterval( timer );    }else{       img.src = "images/left_hnd_"+( myImageNum++ )+".png";    } }, 1000/15 );

HTML5 applicationCache vs Browser Cache

Nancy Den
Updated on 30-Jul-2019 22:30:22

276 Views

HTML5 applicationCacheIt can be understood by an example that a web application is cached, and accessible without a connected internet. Application cache has some advantages: users can use the application when they're offline, cached resources load faster and reduced server load. Browser cache Web browsers use caching to store HTML web pages by storing a copy of visited pages. After that, the copy is used to render when you visit that page again

Advertisements