Archive | JS

RSS feed for this section

HTML5 canvas: create animated character with sprite sheets

Today, we learn how to create animated character with sprite sheets, json and javascript. We use the below sprites sheet: Copyright: Mozilla & Github And json data: https://raw.githubusercontent.com/mozilla/BrowserQuest/master/client/sprites/clotharmor.json Copyright: Mozilla & Github First step: analysis the structure of the json file and the sprite sheets Seeing the json file, we can determine the size of […]

Read full story Comments { 0 }

Using Colorbox JQuery plugin to autoload a Lightbox

Here the sample code using Colorbox JQuery plugin: We receive the result: Problem with Colorbox JQuery plugin However, when we use Colorbox with other JS library or older JQuery, like the example below: We get the Error: Error: $(“.inline”).colorbox is not a function We must use $.noConflict() method:

Read full story Comments { 0 }
Google Maps JavaScript API v3: how to get the center lat & lon of a polygon

Google Maps JavaScript API v3: how to get the center lat & lon of a polygon

How to get the center lat & lon of a polygon? We can do it just by calling polygon.getBounds().getCenter() Note: in Google Maps JavaScript API v2, Polygon had a getBounds() method, but that doesn’t exist for v3 Polygon. You can find that method in this article.

Read full story Comments { 0 }
Google Maps JavaScript API v3: method Polygon.getBounds

Google Maps JavaScript API v3: method Polygon.getBounds

In Google Maps JavaScript API v2, Polygon had a getBounds() method, but that doesn’t exist for v3 Polygon. Here’s the solution: Here, we present a simplified method: Image copyright: Google maps

Read full story Comments { 0 }
Google Maps JavaScript API v3: method Polyline.getBounds

Google Maps JavaScript API v3: method Polyline.getBounds

In Google Maps JavaScript API v2, Polyline had a getBounds() method, but that doesn’t exist for v3 Polyline. I wrote some methods below: Method 1: Method 2: Method 3 is the shortest method. Image copyright: Google Maps

Read full story Comments { 0 }

PHP: convert javascript escape string to CP1251

This function can convert javascript escape string to CP1251: Example 2: result: ຈະນານຸກົມພິເສດ Read more: PHP: convert javascript escape string to UTF8

Read full story Comments { 0 }
PHP: convert javascript escape string to UTF8

PHP: convert javascript escape string to UTF8

Read first: PHP: PHP: Convert Numeric Character Reference to UTF8 Example 1: U+0621: ARABIC LETTER HAMZA Java Escape: “\u0621” Javascript Escape: “\u0621” result: ء We can create this function below: Example 2: result: สารานุกรมเสรี Alternative function:

Read full story Comments { 0 }
Simple Javascript OOP tutorial

Simple Javascript OOP tutorial

JavaScript Objects An object is a collection of Methods and properties. Javascript has predefined object types such as: Array, Boolean, Date, Function, Image, Number, Object, Option, RegExp, or String it also allows you to create your own user defined objects.

Read full story Comments { 0 }

Multilevel drop down menu horisontal with CSS/JS/HTML

Horizontal drop down menu in several levels – or as we “drop down menu multilevel horisontal” is a common element of the website. When you first decide to locate in our code seems to be a very simple task, a few lines of html, css and a pair of nearly!

Read full story Comments { 0 }