background preloader

Slide Elements in Different Directions

Slide Elements in Different Directions
Although jQuery has a nice set of slide methods — .slideDown(), .slideUp(), and .slideToggle() — sometimes we may want to slide an element in a different direction. Fortunately, it's pretty easy to do. Reverse the Slide Direction With the built-in slide methods, elements are shown by sliding them down and into view. <div id="slidebottom" class="slide"> <button>slide it</button> <div class="inner">Slide from bottom</div></div> To get the inner div to slide up, we'll anchor its bottom edge to the bottom of the bottom of the nearest positioned ancestor (in this case, the #slidebottom div): Other properties such as width, padding, margin, and background-color have been set for these elements, but only the essential properties for modifying the slide behavior are shown above. Note: I'll be using the term positioned to refer to elements that have the CSS position property set to something other than "static." Now, we can write the jQuery the same way we would with a traditional slide effect: Related:  jquery

.toggleClass() Description: Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument, while animating all style changes. Similar to native CSS transitions, jQuery UI's class animations provide a smooth transition from one state to another while allowing you to keep all the details about which styles to change in CSS and out of your JavaScript. All class animation methods, including .toggleClass(), support custom durations and easings, as well as provide a callback for when the animation completes. Not all styles can be animated. This plugin extends jQuery's built-in .toggleClass() method.

12 Wesbite to Learn jQuery Jquery is a great way to get a lot of cool things to happen on your website. You must take the time to learn it, in this post I give you 12 Wesbites to Learn jQuery. This is just to get your feet wet its always best to take a class or pick up a book. jquery-mix.com jqueryfordesigners.com 15daysofjquery.com jqueryking.com addyosmani.com docs.jquery.com tutorialzine.com visualjquery.com jquerystock.com developphp.com jquerystyle.com marcgrabanski.com Créer un compte à rebours / chronomètre en HTML 5 + Javascript Ici nous allons voir comment créer un compte à rebours en Javascript, en utilisant jQuery. Pour commencer, voici le code HTML qui va servir à afficher le temps restant avant la fin du compte à rebours : nombre de jours, heures, minutes, secondes : Le but du jeu va donc être de remplir les 4 <span> en javascript, à intervalle régulier (toutes les secondes), au fur et à mesure que le temps passe et qu'on se rapproche de la fin du décompte. Pour gérer le compte à rebours, ils nous faut 2 informations de base : La date "cible" : celle à laquelle le compte à rebours se termine, et vaut 00:00:00 La date courante En faisant la différence entre ces 2 dates, ont va connaître le nombre de secondes qui nous sépare de la fin du compte à rebours. Pour calculer le nombre de jours, heures..., je vais utiliser une fonction dateDiff écrite dans le cadre d'une autre FAQ : Calculer la différence entre 2 dates en Javascript. On va aussi utiliser jQuery pour sélectionner les 4 span ci-dessus.

Custom Selectors - jQuery Select all elements that are in the progress of an animation at the time the selector is run. Selects elements that have the specified attribute with a value either equal to a given string or starting with that string followed by a hyphen (-). Selects elements that have the specified attribute with a value containing the a given substring. Selects elements that have the specified attribute with a value containing a given word, delimited by spaces. Selects elements that have the specified attribute with a value ending exactly with a given string. Selects elements that have the specified attribute with a value exactly equal to a certain value. Select elements that either don’t have the specified attribute, or do have the specified attribute but not with a certain value. Selects elements that have the specified attribute with a value beginning exactly with a given string. Selects all button elements and elements of type button. Selects all elements of type checkbox.

.fadeToggle Description: Display or hide the matched elements by animating their opacity. The .fadeToggle() method animates the opacity of the matched elements. When called on a visible element, the element's display style property is set to none once the opacity reaches 0, so the element no longer affects the layout of the page. Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The strings 'fast' and 'slow' can be supplied to indicate durations of 200 and 600 milliseconds, respectively. Easing The string representing an easing function specifies the speed at which the animation progresses at different points within the animation. Callback Function If supplied, the callback is fired once the animation is complete.

CSS selectors jQuery Select all elements that are in the progress of an animation at the time the selector is run. Selects elements that have the specified attribute with a value either equal to a given string or starting with that string followed by a hyphen (-). Selects elements that have the specified attribute with a value containing the a given substring. Selects elements that have the specified attribute with a value containing a given word, delimited by spaces. Selects elements that have the specified attribute with a value ending exactly with a given string. Selects elements that have the specified attribute with a value exactly equal to a certain value. Select elements that either don’t have the specified attribute, or do have the specified attribute but not with a certain value. Selects elements that have the specified attribute with a value beginning exactly with a given string. Selects all button elements and elements of type button. Selects all elements of type checkbox.

jQuery: how to trigger hover out 3 Simple Things to Make Your jQuery Code Awesome jQuery is one of the most popular (if not the most) JavaScript libraries in existence and a great number of people use it to do some amazing things. Personally, jQuery is what got me excited for learning JavaScript. The problem is that a lot of programmers don't understand that with all that power massive amounts of CPU cycles are used. As much as jQuery engineers try to optimize jQuery, they are always limited in how fast they can make it go. There are a few things that you, as a user of jQuery, can do to make your jQuery code faster. 1 - jQuery Object Caching Caching your jQuery objects may possibly be the best thing you can do to cut your code down to run leaner and meaner. In all of these cases, you could save some DOM searching trips by assigning the jQuery object to a variable (generally prefixed with a dollar sign to distinguish it as a jQuery object), like so: 2 – Selector Optimization The following selectors are ranked from fastest to slowest. 3 – Delegating Events About the Author

JQuery Redirect to URL after specified time

Related: