Posted on May 21, 2009. Filed under
Coding.
4 Comments »
For those who like to use setTimeout() in javascript, you’ve probably notice you cant use that function in jQuery. By using the animate function you can delay all the jQuery you want.
$('#test').slideDown('normal').animate({opacity:"1.0"}, 3000).slideUp('normal');
Works in the order from left to right. slideDown() will happen immediately than a 3 second delay will occur right after. This delay is actually the amount of time the CSS is applied to the ID test. By putting opacity set to 100%, it literally doesn’t do anything but delay the next function. So slideUp() doesn’t start until animate() is done (which is 3000 milliseconds or 3 seconds).
$('#test').slideDown('normal').
slideUp('normal').slideDown('normal').
animate({opacity:"1.0"}, 3000).slideUp('normal');
Will go down, up, down, wait 3 seconds, then back up.
Try it out using<div id="test">Test</div>.
Posted on May 4, 2009. Filed under
Concepts.
No Comments »
If your familiar with jQuery then you are very aware of what jQuery’s capabilities are and the limitless things you can do with them but can you utilize the functions properly? You can use jQuery for a quick movement of a widget or a fade in fade out for your tabs on the left or right hand side of your site but how about having a uniform way of using the functions. For example, every option on your widget should have a button that sends info through the AJAX function and returns information that second. This means your polls, image rotations (or ads), RSS feeds, and videos should have some function that sends info and returns information via jQuery->AJAX. If all your plug-ins on your site requires a new page when being interacted with, its time to use jQuery to optimize your user interface.
Initializing such a task is actually very difficult at start because there are a lot of items that need to be checked off. Call methods need to be kept clean in the source code and server-side scripts need to be organized in the root folders. Creating safe and secure scripts is also another priority. Try to keep everything uniform for your widgets (design and interface). Also the programming aspect of the widgets must have UI-friendly responses.