background preloader

JS/Jquery

Facebook Twitter

Generate random number between two numbers in JavaScript. Bouncing Ball Animation < CSS. Tweet10 Shares5 Shares0 Tweets6 Comments Following on from our introduction to CSS Transforms, and using lessons learned from implementing 3D Transforms and Animations, this article presents an animation of a bouncing ball - for now just in two dimensions, but it shouldn't be too much of a step to move to three.

Bouncing Ball Animation < CSS

These animation will now work in Safari, Chrome, Firefox, Opera and Internet Explore 10. Not all browsers support 3D transformations so the effect can be less dramatic. At the time of writing only WebKit browsers still require a prefix. 1. For this animation we're going to use two keyframes - one to translate the ball horizontally with a constant velocity and a second to apply a roughly parabolic vertical bouncing motion. The horizontal motion can be easily implemented using the following keyframe: This keyframe will be referenced later using the assigned name 'travel' and applied using a linear transition timing function that changes direction with each iteration.

Typography Effects with CSS3 and jQuery. One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin.

Typography Effects with CSS3 and jQuery

He lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arches into stiff sections. The bedding was hardly able to cover it and seemed ready to slide off any moment. His many legs, pitifully thin compared with the size of the rest of him, waved about helplessly as he looked. "What's happened to me? " he thought. A collection of textile samples lay spread out on the table - Samsa was a travelling salesman - and above it there hung a picture that he had recently cut out of an illustrated magazine and housed in a nice, gilded frame.

Gregor then turned to look out the window at the dull weather. Animsition. Sliding Letters with jQuery. jQuery API Documentation. Auto-Hiding Navigation in CSS and jQuery. A simple navigation that auto-hides when the user scrolls down, and becomes visible when the user scrolls up.

Auto-Hiding Navigation in CSS and jQuery

Browser support ie Chrome Firefox Safari Opera 9+ Auto-hiding navigations have been around for quite some time now, in particular on mobile devices. The idea behind this UX pattern is simple yet efficient: we want the navigation to be easy to reach all the time, so we stick it on top. However, we auto-hide it when the user scrolls down, to create more room for the content. If the user scrolls up, we interpret his behaviour as a will to access the navigation, so we bring it back. Since we’ve been using this approach in several clients’ projects, we thought it would be handy to have a ready-to-use snippet here on CodyHouse.

Images: Unsplash Creating the structure The HTML structure is composed of a header.cd-auto-hide-header element used to wrap the primary navigation (nav.cd-primary-nav) and a main.cd-main-content for the page main content. Adding style Events handling. jQuery Cheat Sheet. Selectors Basics Hierarchy Basic Filters Content Filters Visibility Filters Attribute Child Filters Forms Attributes / CSS Attributes Dimensions Offset Data Manipulation Copying .clone() DOM Insertion, Around DOM Insertion, Inside DOM Insertion, Outside DOM Removal DOM Replacement Traversing Filtering Miscellaneous Traversing Tree Traversal Events Browser Events Document Loading Event Handler Attachment Form Events Keyboard Events Mouse Events Event Object Effects Custom Fading Sliding Ajax Global Ajax Event Handlers.

jQuery Cheat Sheet

JavaScript Regular Expression Cheatsheet - Debuggex. Examples. Basic gradients animation Basic gradients animation with 3 gradients in queue composed of 2 colors.

Examples

Radial gradients animation Radial gradients animation with 3 gradients in queue composed of 2 colors. Dynamic Drive DHTML(dynamic html) & JavaScript code library. How jQuery Works. This is a basic tutorial, designed to help you get started using jQuery.

How jQuery Works

If you don't have a test page setup yet, start by creating the following HTML page: The src attribute in the <script> element must point to a copy of jQuery. Download a copy of jQuery from the Downloading jQuery page and store the jquery.js file in the same directory as your HTML file. Note: When you download jQuery, the file name may contain a version number, e.g., jquery-x.y.z.js. Make sure to either rename this file to jquery.js or update the src attribute of the <script> element to match the file name. To ensure that their code runs after the browser finishes loading the document, many JavaScript programmers wrap their code in an onload function: Unfortunately, the code doesn't run until all images are finished downloading, including banner ads.

For example, inside the ready event, you can add a click handler to the link: Copy the above jQuery code into your HTML file where it says // Your code goes here. 55 Fresh jQuery Gallery And Image Sliders: Best of 2016.