background preloader

Javascript

Facebook Twitter

Controlling CSS Animations and Transitions with JavaScript. The following is a guest post by Zach Saucier. Zach wrote to me telling me that, as a frequenter on coding forums like Stack Overflow, he sees the questions come up all the time about controlling CSS animations with JavaScript, and proved it with a bunch of links. I've had this on my list to write about for way too long, so I was happy to let Zach dig into it and write up this comprehensive tutorial.

Web designers sometimes believe that animating in CSS is more difficult than animating in JavaScript. While CSS animation does have some limitations, most of the time it's more capable than we give it credit for! Not to mention, typically more performant. Coupled with a touch of JavaScript, CSS animations and transitions are able to accomplish hardware-accelerated animations and interactions more efficiently than most JavaScript libraries. Let's jump straight in! Quick Note: Animations and Transitions are Different In this article we will cover each of them separately. Manipulating CSS Matrixes. Animating with Javascript - An article to get you started on Javascript animation. Animating elements with Javascript using DOM compliant, non-invasive code Color fading and resizing to notify user for dynamic changes created on 29.08.2005 Javascript animations are seen more and more in our daily web routines. Most can be annoying too, if they simply serve the purpose to lamely look cool, while they may actually only distract the user.

However, when used properly, they can really add to the user experience, and increase the useability of your site. Also, with the advent of the DOM, the more widespread usage of new generation browsers, and the adoption of xmlHttpRequest and other technologies which all together are called AJAX, the need for notifying user with what is going on with simple animations can become a necessity, such as using fading colors and resizing elements. Actually, I am putting such an animation to good use on this very page, while step-by-step explaining the main animation function for resizing. Fade, single direction, no memory Hover over me! Click Me! How to Create a JavaScript Animation.

JavaScript animations aren't difficult to write. Once you learn a few main ideas, you can create complex animations that take up as much or as little of the browser window as you like, including interactive content that degrades well for people who don't have JavaScript enabled. What's more, the content inside your animations will be available to search engines because the content is in machine-readable (X)HTML. In this tutorial we'll start out with the basics of animation, how to make things move, turn animations on and off, and determine the edges of the space where you want the motion to take place. All of the code in this tutorial has been tested on Mozilla Firefox, Windows, Linux, Konquerer on Linux and MS IE on Windows.

A Matter of Timing At some point most of us have played with a flip book to see how animation works. The classic flip book is a little ball that bounces around the field of the page as the pages flip past. Examples: Timeout example: Interval example: Convert a MySQL Date String into Javascript Date Object | Jordon Mears. Here is a Javascript function that I threw together the other day that will take the default format of a MySQL DATETIME or TIMESTAMP field (YYYY-MM-DD HH:MM:SS) and convert it into a Date object in Javascript.

Leave a Reply. Disable a link a href (HTML, CSS and JavaScript forum at JavaRanch) CSS/JavaScript Use Div to grey out section of page. Basics : Variables - JavaScript Tutorial - EchoEcho.Com - Beginners best choice! Variables can be compared to small boxes with names. If you were to store 5 pair of shoes, you might have a box for each pair. On each box you would write what is in it. The boxes would be your variables. - Places to store things.The name on the boxes would be the variable names. . - The ones you'd use when referring to each of the boxes.And finally the shoes, would be the content of the variables. - What is stored in the boxes.A variable is simply a place in the computer's memory to store information.

All variables are referred to by the unique name you assigned to them. Consider this example: This example would write "Henrik" in the document. Note that when you want text to be stored in a variable you need to put the text in " ". Look at this example to see the importance of this. Try to predict the output of the example before reading on. - In the first line, the text "my first name" is stored in the Henrik variable. - In the second line, the Henrik variable is stored in the myname variable. Redirect. You're moving to a new domain name. You have a time-delay placeholder on your download site. You have a list of external web servers that are helping to mirror your site. What will help you deal with and/or take advantage of these situations? JavaScript redirects will. When your webpage is moved, you'd probably want to notify your visitors of the change. One good way is to place a "redirect page" at the old location which, after a timed delay, will forward visitors to the new location of your webpage.

Control over what page is loaded into the browser rests in the JavaScript property window.location. HTML & JavaScript Code: Implementing a timed delay in JavaScript is useful in the following situations: Showing an "Update your bookmark" page when you have to change URLs or page locations For download sites that wish to have a timed delay before the download starts To refresh a webpage once every specified number of seconds <html><head><script type="text/javascript"><! View Page: JavaScript - Confirm Alert Box. Dynamically creating the rows in table. Dynamically Add/Remove rows in HTML table using JavaScript. [ad name=”AD_INBETWEEN_POST”] A good web design involves the better user interaction and ability to fetch the data in a better way.

For fetching user data, you may have to create a form wherein user can add multiple entries and submit them simultaneously. Thus for this you will need a way to add or remove fields dynamically into the HTML page. In my previous article, I had discussed about the way one can add dynamic form components into the web page. In this article we will create a user interface where user can add/delete multiple rows in a form using JavaScript. First check the user interface. In this example, we have created a table which will display our html components. On pressing Add Row, a dynamic row will be created and added in the table. Following is the source. Code For adding dynamic row in table, we have used insertRow() method. Check the online demo. Online Demo Click here. Add/Remove rows from table having Drop Down List Following is the code: Click here.

Will change into: Html - JavaScript to add dynamic rows for submission returns only first row of data. Nodstrum. AutoCompleter Tutorial As always, links to a demo and ZIP at the bottom, Enjoy! I thought i would write this tutorial because most of the auto completer applications i have seen just dump the code into a zip and tell you how to use it rather than how and why it works, knowing about this enables you to customise it a lot more (this has been demonstrated with the other apps i have written here)! And so we begin:JavaScript JS Explaniation Ok, the above code it the guts to the script, this allows us to hook into the rpc.php file which carries out all the processing.

The Lookup function takes the word from the input box and POSTS it to the rpc.php page using the jQuery Ajax POST call. IF the inputString is ’0′ (Zero), it hides the suggestion box, naturally you would not want this showing if there is nothing in the text box. to search for. ELSE we take the ‘inputString’ and post it to the rpc.php page, the jQuery $.post() function is used as follows… $.post(url, [data], [callback]) PHP Explaination. Ajax-Driven JavaScript ComboBox with Autocomplete - dhtmlxCombo.

DhtmlxCombo is a cross-browser JavaScript combobox with an autocomplete feature. It extends basic select box functionality and provides the ability to display suggestions while a user types in the text field. dhtmlxCombo can be converted from existing instances of HTML Select, or populated with JavaScript. With Ajax data loading, it can get the list of values dynamically from the server datasource. Live demo Filtering mode: (filter existing list) Autocomplete mode:(start typing to load country names from server) dhtmlxCombo can be used in four modes: Editable select box - A user can either select a value from the list or type a custom value.

Like other DHTMLX components, dhtmlxCombo provides a complete JavaScript API to give developers a wide range of options to control the component state and behavior. Features View Feature Details Editions dhtmlxCombo is available in the Standard Edition only. Licenses Open Source - GPL - Allows the use of dhtmlxCombo in GPL-licensed projects for free. Buy it. JavaScript Event Calendar - Ajax Scheduler - dhtmlxScheduler. DhtmlxScheduler 4.3 is out with lots of new features and improvements! What's New Product Features Lightweight Powerful JavaScript API Intuitive drag-and-drop interface Multiple views: Day, Week, Month, Year, Agenda, Timeline (PRO) Grid (PRO) Multilingual (25 languages) PHP, ASP.NET, Java, CF connectors Single/multi-day events Recurring events iCal format support Bootstrap compatibility Export to XML, iCal, JSON, PDF Custom form for recurring events Multiple schedulers on page (PRO) Multisection Events (PRO) Multiday Units View Ability to display the days instead of sections in Timeline view New events for the 'expand' extension Ability to link events using the URL extension Customizable time scales Mobile version for iOS and Android Google Map integration Easy REST API integration Completely Customizable The rich JavaScript API allows you to change virtually every aspect of the calendar's look and feel, including colors, texts, scales, first day of the week, etc.

Simple API Free under GPL. Doing real-time calculations in a form using JavaScript. In this tutorial, we will learn how to perform calculations using JavaScript. It is quite often required to do calculations online in order forms, request quote forms and the like. This tutorial will show you how to use different form elements like drop-down list, radio button, check box and text box in a calculation. We will be using a ‘cake order form’ as an example. As the user makes selections in the form, the total price is calculated in real time.

See the Demo Working with Form Elements Before we can start coding the JavaScript, we need to have a form to work with. This is just basic HTML code for a form. How to reference a form object in JavaScript Before we can do any calculations in the form, we must first have a reference to the form in our JavaScript code. How to use radio buttons in a calculation In order to use radio buttons in a calculation, we need to give the radio buttons a name. Each type of cake has a different price. We again use an associative array to map to the price.