Arjun Thakur

Arjun Thakur

749 Articles Published

Articles by Arjun Thakur

Page 21 of 75

How to make an Ember.js app offline with server sync when available?

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 172 Views

Making an Ember.js app work offline with server synchronization requires implementing client-side storage that can sync data when connectivity is restored. This enables users to continue working with your app even without internet access. Using LocalStorage Adapter The ember-localstorage adapter provides basic offline storage capabilities by storing data in the browser's localStorage: App.store = DS.Store.create({ revision: 11, adapter: DS.LSAdapter.create() }); Advanced Offline Storage with IndexedDB For more robust offline functionality, use IndexedDB which provides better performance and storage capacity: App.Store = DS.SyncStore.extend({ ...

Read More

HTML5 Canvas Degree Symbol

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 525 Views

The HTML5 Canvas API allows you to display special characters like the degree symbol (°) in text. You can use HTML entities or Unicode characters to render the degree symbol on canvas. Using HTML Entity for Degree Symbol The most common approach is using the HTML entity ° which renders as the degree symbol (°). body { ...

Read More

How to draw an oval in HTML5 canvas?

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 1K+ Views

Drawing an oval in HTML5 canvas can be achieved by scaling a circle. Since canvas doesn't have a built-in oval method, we use the scale() transformation to stretch a circle into an elliptical shape. How It Works The technique involves three steps: Save the current canvas state with save() Apply scaling transformation to stretch the circle Draw a circle using arc(), which appears as an oval due to scaling Restore the original state with restore() Example HTML5 Canvas Oval ...

Read More

Play infinitely looping video on-load in HTML5

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 5K+ Views

HTML5 provides built-in support for playing videos that loop infinitely using the loop attribute. This is useful for background videos, animations, or promotional content that should continuously play. Basic Syntax The element supports three main video formats: MP4, WebM, and Ogg. To create an infinitely looping video, combine the autoplay and loop attributes: Your browser does not support the video element. Key Attributes autoplay: Starts the video automatically when the page loads loop: A boolean attribute that restarts ...

Read More

Bootstrap Contextual classes

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 2K+ Views

Bootstrap contextual classes allow you to change the background color of table rows or individual cells to convey different meanings and states. These classes provide visual feedback to users about the status or importance of data. Available Contextual Classes Class Description Visual Effect ...

Read More

How to draw grid using HTML5 and canvas or SVG?

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 748 Views

HTML5 provides two powerful ways to create grid patterns: Canvas and SVG. Both offer different advantages depending on your needs. Drawing Grid Using HTML5 Canvas Canvas provides a pixel-based approach for drawing grids programmatically. Here's how to create a basic grid: // Get canvas and context const canvas = document.getElementById('gridCanvas'); const ctx = canvas.getContext('2d'); // Grid settings const gridSize = 20; // Size of each grid cell const canvasWidth = canvas.width; const canvasHeight = canvas.height; // Set line style ctx.strokeStyle = '#ddd'; ctx.lineWidth = 1; // Draw vertical lines for (let x = 0; x

Read More

Mouse event not being triggered on HTML5 canvas? How to solve it?

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 602 Views

When HTML5 canvas mouse events fail to trigger, it's often due to CSS transforms or missing event listeners. Here are proven solutions to fix this issue. Problem: CSS Transform Interference CSS 3D transforms can interfere with mouse event coordinates on canvas elements. The solution is to force hardware acceleration: /* Add this CSS to your canvas */ canvas { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); } Solution 1: Adding Mouse Event Listeners Ensure you properly attach event listeners to the canvas element: ...

Read More

Add sizes for Bootstrap Buttons

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 323 Views

Bootstrap provides several CSS classes to control button sizes, from large buttons to block-level buttons that span the full width of their container. Button Size Classes Class Description .btn-lg ...

Read More

How to write a JavaScript function to get the difference between two numbers?

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 9K+ Views

Use Math.abs() inside a JavaScript function to get the difference between two numbers in JavaScript. The Math.abs() method returns the absolute value, ensuring you always get a positive difference regardless of which number is larger. Syntax function getDifference(num1, num2) { return Math.abs(num1 - num2); } Example: Using Math.abs() for Difference You can try to run the following code to get the difference of numbers: var num1, num2; ...

Read More

Animate vertical-align property with CSS Animation

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 603 Views

The CSS vertical-align property can be animated using CSS animations to create smooth transitions between different vertical alignment values. This is particularly useful for animating inline elements like images, text, or inline-block elements. Syntax selector { vertical-align: initial-value; animation: animation-name duration; } @keyframes animation-name { percentage { vertical-align: target-value; } } Example: Animating Image Vertical Alignment The following example demonstrates how to animate the vertical alignment of an image ...

Read More
Showing 201–210 of 749 articles
« Prev 1 19 20 21 22 23 75 Next »
Advertisements