{"id":1942,"date":"2009-10-04T04:48:54","date_gmt":"2009-10-04T08:48:54","guid":{"rendered":"http:\/\/www.andysowards.com\/blog\/?p=1942"},"modified":"2009-10-09T21:08:06","modified_gmt":"2009-10-10T01:08:06","slug":"how-to-add-flair-to-your-actions-with-jquery-part-1-javascript-tutorial","status":"publish","type":"post","link":"https:\/\/www.andysowards.com\/blog\/2009\/how-to-add-flair-to-your-actions-with-jquery-part-1-javascript-tutorial\/","title":{"rendered":"How to Add Flair to your Actions with jQuery &#8211; Part 1 &#8211; Javascript Tutorial"},"content":{"rendered":"<h2>How to Add Flair to your Actions with jQuery <\/h2>\n<blockquote>\n<p>If actions speak louder than words, then in the JavaScript world, effects make actions speak louder still. With jQuery, we can easily add impact to our actions through a set of simple visual effects, and even craft our own, more sophisticated <b>animations <\/b>. <\/p>\n<p>jQuery effects certainly add flair, as is evident when we see elements gradually slide into view instead of appearing all at once. However, they can also provide important usability enhancements that help orient the user when there is some change on a page (especially common in AJAX applications). In this article by <b>Jonathan Chaffer <\/b> and <b>Karl Swedberg <\/b>, we will explore a number of these effects and combine them in interesting ways. <\/p>\n<\/blockquote>\n<h1>Inline CSS modification <\/h1>\n<p>Before we jump into the nifty jQuery effects, a quick look at CSS is in order. One way of modifying a document&#8217;s appearance is by defining styles for classes in a separate stylesheet and then adding or removing those classes with jQuery. Typically, this is the preferred process for injecting CSS into HTML because it respects the stylesheet&#8217;s role in dealing with the presentation of a page. However, there may be times when we need to apply styles that haven&#8217;t been, or can&#8217;t easily be, defined in a stylesheet. Fortunately, jQuery offers the <i>.css() <\/i> method for such occasions. <\/p>\n<p>This method acts as both a <b>getter <\/b> and a <b>setter <\/b>. To get the value of a style property, we simply pass the name of the property as a string, like <i>.css(&#8216;backgroundColor&#8217;) <\/i>. Multi-word properties can be interpreted by jQuery when hyphenated, as they are in CSS notation ( <i>background-color <\/i>), or camel-cased, as they are in DOM notation ( <i>backgroundColor <\/i>). For setting style properties, the <i>.css() <\/i> method comes in two flavors&#8212;one that takes a single style property and its value and one that takes a <b>map <\/b> of property-value pairs: <\/p>\n<pre style=\"margin-left: 20px;\">.css('property','value') <br\/>.css({property1: 'value1', 'property-2': 'value2'}) <br\/> <\/pre>\n<p>Experienced JavaScript developers will recognize these jQuery maps as JavaScript <b>object literals <\/b>. <\/p>\n<p style=\"margin-left: 20px; margin-right: 20px;\"> <em>Numeric values do not take quotation marks while string values do. However, when using the map notation, quotation marks are not required for property names if they are written in camel-cased DOM notation. <\/em> <\/p>\n<p>We use the <i>.css() <\/i> method the same way as using <i>.addClass() <\/i> &#8212;by <b>chaining <\/b> it to a selector and <b>binding <\/b> it to an event. To demonstrate this, we&#8217;ll use the style switcher example. <\/p>\n<pre style=\"margin-left: 20px;\"> <div id=\"switcher\"> <br\/> <div class=\"label\">Text Size <\/div> <br\/> <button id=\"switcher-default\">Default <\/button> <br\/> <button id=\"switcher-large\">Bigger <\/button> <br\/> <button id=\"switcher-small\">Smaller <\/button> <br\/> <\/div> <br\/> <div class=\"speech\"> <br\/> <p>Fourscore and seven years ago our fathers brought forth <br\/> on this continent a new nation, conceived in liberty, <br\/> and dedicated to the proposition that all men are created <br\/> equal. <\/p> <br\/> <\/div> <br\/> <\/pre>\n<p>By linking to a stylesheet with a few basic style rules, the page can initially look like the following screenshot: <\/p>\n<p style=\"text-align: center;\"> <img decoding=\"async\" data-src=\"http:\/\/www.packtpub.com\/files\/images\/jquery_article1_image01.png\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" \/> <\/p>\n<p>In this version of the style switcher, we&#8217;re using <button id=\"switcher-large\">&#8211; <\/button> elements. Clicking on the <b>Bigger <\/b> and <b>Smaller <\/b> buttons will increase or decrease the text size of , while clicking on the <b>Default <\/b> button will reset to its original text size. <\/p>\n<p>If all we wanted were to change the font size a single time to a predetermined value, we could still use the <i>.addClass() <\/i> method. But let&#8217;s suppose that now we want the text to continue increasing or decreasing incrementally each time the respective button is clicked. Although it might be possible to define a separate class for each click and iterate through them, a more straightforward approach would be to compute the new text size each time by getting the current size and increasing it by a set factor (for example, 40%). <\/p>\n<p>Our code will start with the <i>$(document).ready() <\/i> and <i>$(&#8216;#switcher-large&#8217;) <\/i>.click() event handlers: <\/p>\n<pre style=\"margin-left: 20px;\">$(document).ready(function() { <br\/> $('#switcher-large').click(function() { <br\/> }); <br\/>}); <br\/> <\/pre>\n<p>Next, the font size can be easily discovered by using the <i>.css() <\/i> method: <i>$(&#8216;div.speech&#8217;).css(&#8216;fontSize&#8217;). <\/i> However, because the returned value will include a trailing &#8216; <i>px <\/i>&#8216;, we&#8217;ll need to strip that part in order to perform calculations with the value. Also, when we plan to use a jQuery object more than once, it&#8217;s generally a good idea to <b>cache <\/b> the selector by storing the resulting jQuery object in a variable as well. <\/p>\n<pre style=\"margin-left: 20px;\">$(document).ready(function() { <br\/> <span style=\"font-weight: bold;\">var $speech = $('div.speech'); <\/span> <br\/> $('#switcher-large').click(function() { <br\/> <span style=\"font-weight: bold;\">var num = parseFloat($speech.css('fontSize'), 10); <\/span> <br\/> }); <br\/>}); <br\/> <\/pre>\n<p>The first line inside <i>$(document).ready() <\/i> now stores a variable for itself. Notice the use of a <i>$ <\/i> in the variable name, <i>$speech <\/i>. Since <i>$ <\/i> is a legal character in JavaScript variables, we can use it as a reminder that the variable is storing a jQuery object. <\/p>\n<p>Inside the <i>.click() <\/i> handler, we use <i>parseFloat() <\/i> to get the font size property&#8217;s number only. The <i>parseFloat() <\/i> function looks at a string from left to right until it encounters a non-numeric character. The string of digits is converted into a floating-point (decimal) number. For example, it would convert the string &#8216; <i>12&#8242; <\/i> to the number 12. In addition, it strips non-numeric trailing characters from the string, so <i>&#8217;12px&#8217; <\/i> becomes 12 as well. If the string begins with a non-numeric character, <i>parseFloat() <\/i> returns NaN, which stands for <b>Not a Number <\/b>. The second argument for <i>parseFloat() <\/i> allows us to ensure that the number is interpreted as base-10 instead of octal or some other representation. <\/p>\n<p>All that&#8217;s left to do, if we are increasing by 40%, is to multiply <i>num <\/i> by 1.4 and then set the font size by concatenating <i>num <\/i> and <i>&#8216;px&#8217; <\/i>: <\/p>\n<pre style=\"margin-left: 20px;\">$(document).ready(function() { <br\/> var $speech = $('div.speech'); <br\/> $('#switcher-large').click(function() { <br\/> var num = parseFloat($speech.css('fontSize'), 10 ); <br\/> <span style=\"font-weight: bold;\">num *= 1.4; <\/span> <br\/> <span style=\"font-weight: bold;\">$speech.css('fontSize', num + 'px'); <\/span> <br\/> }); <br\/>}); <br\/> <\/pre>\n<p style=\"margin-left: 20px; margin-right: 20px;\"> <em>The equation num *= 1.4 is shorthand for num = num * 1.4. We can use the same type of shorthand for the other basic mathematical operations, as well: addition, num += 1.4; subtraction, num -= 1.4; division, num \/= 1.4; and modulus (division remainder), num %= 1.4. <\/em> <\/p>\n<p>Now when a user clicks on the <b>Bigger <\/b> button, the text becomes larger. Another click, and the text becomes larger still, as shown in the following screenshot: <\/p>\n<p style=\"text-align: center;\"> <img decoding=\"async\" data-src=\"http:\/\/www.packtpub.com\/files\/images\/jquery_article1_image02.png\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" \/> <\/p>\n<p>To get the <b>Smaller <\/b> button to decrease the font size, we will divide rather than multiply <i>&#8212;num \/= 1.4. <\/i> Better still, we&#8217;ll combine the two into a single <i>.click() <\/i> handler on all <button id=\"switcher-large\">&#8211; <\/button> elements within . Then, after finding the numeric value, we can either multiply or divide depending on the ID of the button that was clicked. Here is what that code looks like now: <\/p>\n<pre style=\"margin-left: 20px;\">$(document).ready(function() { <br\/> var $speech = $('div.speech'); <br\/> <span style=\"font-weight: bold;\">$('#switcher button').click(function() { <\/span> <br\/> var num = parseFloat( $speech.css('fontSize'), 10 ); <br\/> <span style=\"font-weight: bold;\">if (this.id == 'switcher-large') { <\/span> <br\/> <span style=\"font-weight: bold;\">num *= 1.4; <\/span> <br\/> <span style=\"font-weight: bold;\">} else if (this.id == 'switcher-small') { <\/span> <br\/> <span style=\"font-weight: bold;\">num \/= 1.4; <\/span> <br\/> } <br\/> $speech.css('fontSize', num + 'px); <br\/> }); <br\/>}); <br\/> <\/pre>\n<p>We can access the <i>id <\/i> property of the DOM element referred to by <i>this <\/i>, which appears here inside the <i>if <\/i> and <i>else if <\/i> statements. Here, it is more efficient to use <i>this <\/i> than to create a jQuery object just to test the value of a property. <\/p>\n<p>It&#8217;s also nice to have a way to return the font size to its initial value. To allow the user to do so, we can simply store the font size in a variable immediately when the DOM is ready. We can then use this value whenever the <b>Default <\/b> button is clicked. To handle this click, we could add another <i>else if <\/i> statement. However, perhaps a <i>switch <\/i> statement would be more appropriate. <\/p>\n<pre style=\"margin-left: 20px;\">$(document).ready(function() { <br\/> var $speech = $('div.speech'); <br\/> <span style=\"font-weight: bold;\">var defaultSize = $speech.css('fontSize'); <\/span> <br\/> $('#switcher button').click(function() { <br\/> var num = parseFloat( $speech.css('fontSize'), 10 ); <br\/> <span style=\"font-weight: bold;\">switch (this.id) { <\/span> <br style=\"font-weight: bold;\"\/> <span style=\"font-weight: bold;\"> case 'switcher-large': <\/span> <br style=\"font-weight: bold;\"\/> <span style=\"font-weight: bold;\"> num *= 1.4; <\/span> <br style=\"font-weight: bold;\"\/> <span style=\"font-weight: bold;\"> break; <\/span> <br style=\"font-weight: bold;\"\/> <span style=\"font-weight: bold;\"> case 'switcher-small': <\/span> <br style=\"font-weight: bold;\"\/> <span style=\"font-weight: bold;\"> num \/= 1.4; <\/span> <br style=\"font-weight: bold;\"\/> <span style=\"font-weight: bold;\"> break; <\/span> <br style=\"font-weight: bold;\"\/> <span style=\"font-weight: bold;\"> default: <\/span> <br style=\"font-weight: bold;\"\/> <span style=\"font-weight: bold;\"> num = parseFloat(defaultSize, 10); <\/span> <br\/> <br\/> $speech.css('fontSize', num + 'px'); <br\/> }); <br\/>}); <br\/> <\/pre>\n<p>Here we&#8217;re still checking the value of <i>this.id <\/i> and changing the font size based on it, but if its value is neither <i>&#8216;switcher-large&#8217; <\/i> nor <i>&#8216;switcher-small&#8217; <\/i> it will default to the initial font size. <\/p>\n<p> <!-- END PART 1 --><\/p>\n<table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">\n<tbody>\n<tr>\n<td width=\"99\" valign=\"top\"> <a href=\"http:\/\/www.packtpub.com\/learning-jquery-1.3\/book\/mid\/240609o1fp7w\" target=\"_blank\"><img decoding=\"async\" height=\"123\" width=\"99\" border=\"0\" data-src=\"http:\/\/images.packtpub.com\/images\/100x123\/1847196705.png\" alt=\"Learning jQuery 1.3\" class=\"left lazyload\" title=\"Learning jQuery 1.3\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 99px; --smush-placeholder-aspect-ratio: 99\/123;\" \/><\/a><\/td>\n<td valign=\"top\">\n<ul>\n<li>Better Interaction Design and Web Development with Simple JavaScript Techniques<\/li>\n<li>An introduction to jQuery that requires minimal programming experience<\/li>\n<li>Detailed solutions to specific client-side problems<\/li>\n<li>For web designers to create interactive elements for their designs<\/li>\n<li>For developers to create the best user interface for their web applications<\/li>\n<li>Packed with great examples, code, and clear explanations<\/li>\n<li>Revised and updated version of the first book to help you learn jQuery<\/li>\n<\/ul>\n<p>\u00a0\u00a0<a href=\"http:\/\/www.packtpub.com\/learning-jquery-1.3\/book\/mid\/240609o1fp7w\" target=\"_blank\">http:\/\/www.packtpub.com\/learning-jquery-1.3\/book<\/a> <\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Hope you learned something in Part I, Now move on to <a href=\"https:\/\/www.andysowards.com\/blog\/tutorials\/how-to-add-flair-to-your-actions-with-jquery-part-2-javascript-tutorial\/\">Part II of the Adding Flare to your Actions with jQuery series<\/a>!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to Add Flair to your Actions with jQuery If actions speak louder than words, then in the JavaScript world, effects make actions speak louder still. With jQuery, we can<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[73,202,844,34],"tags":[1254,780,176,5885,110,5896,2546,5888,755,84,5886,5890],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Add Flair to your Actions with jQuery - Part 1 - Javascript Tutorial<\/title>\n<meta name=\"description\" content=\"How to Add Flair to your Actions with jQuery If actions speak louder than words, then in the JavaScript world, effects make actions speak louder still.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.andysowards.com\/blog\/2009\/how-to-add-flair-to-your-actions-with-jquery-part-1-javascript-tutorial\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Add Flair to your Actions with jQuery - Part 1 - Javascript Tutorial\" \/>\n<meta property=\"og:description\" content=\"How to Add Flair to your Actions with jQuery If actions speak louder than words, then in the JavaScript world, effects make actions speak louder still.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.andysowards.com\/blog\/2009\/how-to-add-flair-to-your-actions-with-jquery-part-1-javascript-tutorial\/\" \/>\n<meta property=\"og:site_name\" content=\"Daily Business Resources for Entrepreneurs, Web Designers, &amp; Creatives by Andy Sowards\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/andysowardsfan\" \/>\n<meta property=\"article:published_time\" content=\"2009-10-04T08:48:54+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2009-10-10T01:08:06+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.packtpub.com\/files\/images\/jquery_article1_image01.png\" \/>\n<meta name=\"author\" content=\"Packt Publishing\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@andysowards\" \/>\n<meta name=\"twitter:site\" content=\"@andysowards\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Packt Publishing\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.andysowards.com\/blog\/2009\/how-to-add-flair-to-your-actions-with-jquery-part-1-javascript-tutorial\/\",\"url\":\"https:\/\/www.andysowards.com\/blog\/2009\/how-to-add-flair-to-your-actions-with-jquery-part-1-javascript-tutorial\/\",\"name\":\"How to Add Flair to your Actions with jQuery - Part 1 - Javascript Tutorial\",\"isPartOf\":{\"@id\":\"https:\/\/www.andysowards.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.andysowards.com\/blog\/2009\/how-to-add-flair-to-your-actions-with-jquery-part-1-javascript-tutorial\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.andysowards.com\/blog\/2009\/how-to-add-flair-to-your-actions-with-jquery-part-1-javascript-tutorial\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/www.packtpub.com\/files\/images\/jquery_article1_image01.png\",\"datePublished\":\"2009-10-04T08:48:54+00:00\",\"dateModified\":\"2009-10-10T01:08:06+00:00\",\"author\":{\"@id\":\"https:\/\/www.andysowards.com\/blog\/#\/schema\/person\/cd18456865c95a17893e596aa9f4ee1e\"},\"description\":\"How to Add Flair to your Actions with jQuery If actions speak louder than words, then in the JavaScript world, effects make actions speak louder still.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.andysowards.com\/blog\/2009\/how-to-add-flair-to-your-actions-with-jquery-part-1-javascript-tutorial\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.andysowards.com\/blog\/2009\/how-to-add-flair-to-your-actions-with-jquery-part-1-javascript-tutorial\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.andysowards.com\/blog\/2009\/how-to-add-flair-to-your-actions-with-jquery-part-1-javascript-tutorial\/#primaryimage\",\"url\":\"http:\/\/www.packtpub.com\/files\/images\/jquery_article1_image01.png\",\"contentUrl\":\"http:\/\/www.packtpub.com\/files\/images\/jquery_article1_image01.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.andysowards.com\/blog\/2009\/how-to-add-flair-to-your-actions-with-jquery-part-1-javascript-tutorial\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.andysowards.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Add Flair to your Actions with jQuery &#8211; Part 1 &#8211; Javascript Tutorial\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.andysowards.com\/blog\/#website\",\"url\":\"https:\/\/www.andysowards.com\/blog\/\",\"name\":\"Daily Business Resources for Entrepreneurs, Web Designers, &amp; Creatives by Andy Sowards\",\"description\":\"Design Inspiration &amp; Business Resources for Creatives\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.andysowards.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.andysowards.com\/blog\/#\/schema\/person\/cd18456865c95a17893e596aa9f4ee1e\",\"name\":\"Packt Publishing\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.andysowards.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ea4b355a08dfdf148305e48ae3394064?s=96&r=pg\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ea4b355a08dfdf148305e48ae3394064?s=96&r=pg\",\"caption\":\"Packt Publishing\"},\"description\":\"Hi, I'm Jude from Packt Publishing. We have a wide range of books covering various technologies such as Open Source and Enterprise. http:\/\/www.packtpub.com\/\",\"sameAs\":[\"http:\/\/www.packtpub.com\/\"],\"url\":\"https:\/\/www.andysowards.com\/blog\/author\/packtpublishing\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Add Flair to your Actions with jQuery - Part 1 - Javascript Tutorial","description":"How to Add Flair to your Actions with jQuery If actions speak louder than words, then in the JavaScript world, effects make actions speak louder still.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.andysowards.com\/blog\/2009\/how-to-add-flair-to-your-actions-with-jquery-part-1-javascript-tutorial\/","og_locale":"en_US","og_type":"article","og_title":"How to Add Flair to your Actions with jQuery - Part 1 - Javascript Tutorial","og_description":"How to Add Flair to your Actions with jQuery If actions speak louder than words, then in the JavaScript world, effects make actions speak louder still.","og_url":"https:\/\/www.andysowards.com\/blog\/2009\/how-to-add-flair-to-your-actions-with-jquery-part-1-javascript-tutorial\/","og_site_name":"Daily Business Resources for Entrepreneurs, Web Designers, &amp; Creatives by Andy Sowards","article_publisher":"http:\/\/facebook.com\/andysowardsfan","article_published_time":"2009-10-04T08:48:54+00:00","article_modified_time":"2009-10-10T01:08:06+00:00","og_image":[{"url":"http:\/\/www.packtpub.com\/files\/images\/jquery_article1_image01.png"}],"author":"Packt Publishing","twitter_card":"summary_large_image","twitter_creator":"@andysowards","twitter_site":"@andysowards","twitter_misc":{"Written by":"Packt Publishing","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.andysowards.com\/blog\/2009\/how-to-add-flair-to-your-actions-with-jquery-part-1-javascript-tutorial\/","url":"https:\/\/www.andysowards.com\/blog\/2009\/how-to-add-flair-to-your-actions-with-jquery-part-1-javascript-tutorial\/","name":"How to Add Flair to your Actions with jQuery - Part 1 - Javascript Tutorial","isPartOf":{"@id":"https:\/\/www.andysowards.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.andysowards.com\/blog\/2009\/how-to-add-flair-to-your-actions-with-jquery-part-1-javascript-tutorial\/#primaryimage"},"image":{"@id":"https:\/\/www.andysowards.com\/blog\/2009\/how-to-add-flair-to-your-actions-with-jquery-part-1-javascript-tutorial\/#primaryimage"},"thumbnailUrl":"http:\/\/www.packtpub.com\/files\/images\/jquery_article1_image01.png","datePublished":"2009-10-04T08:48:54+00:00","dateModified":"2009-10-10T01:08:06+00:00","author":{"@id":"https:\/\/www.andysowards.com\/blog\/#\/schema\/person\/cd18456865c95a17893e596aa9f4ee1e"},"description":"How to Add Flair to your Actions with jQuery If actions speak louder than words, then in the JavaScript world, effects make actions speak louder still.","breadcrumb":{"@id":"https:\/\/www.andysowards.com\/blog\/2009\/how-to-add-flair-to-your-actions-with-jquery-part-1-javascript-tutorial\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.andysowards.com\/blog\/2009\/how-to-add-flair-to-your-actions-with-jquery-part-1-javascript-tutorial\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.andysowards.com\/blog\/2009\/how-to-add-flair-to-your-actions-with-jquery-part-1-javascript-tutorial\/#primaryimage","url":"http:\/\/www.packtpub.com\/files\/images\/jquery_article1_image01.png","contentUrl":"http:\/\/www.packtpub.com\/files\/images\/jquery_article1_image01.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.andysowards.com\/blog\/2009\/how-to-add-flair-to-your-actions-with-jquery-part-1-javascript-tutorial\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.andysowards.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Add Flair to your Actions with jQuery &#8211; Part 1 &#8211; Javascript Tutorial"}]},{"@type":"WebSite","@id":"https:\/\/www.andysowards.com\/blog\/#website","url":"https:\/\/www.andysowards.com\/blog\/","name":"Daily Business Resources for Entrepreneurs, Web Designers, &amp; Creatives by Andy Sowards","description":"Design Inspiration &amp; Business Resources for Creatives","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.andysowards.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.andysowards.com\/blog\/#\/schema\/person\/cd18456865c95a17893e596aa9f4ee1e","name":"Packt Publishing","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.andysowards.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ea4b355a08dfdf148305e48ae3394064?s=96&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ea4b355a08dfdf148305e48ae3394064?s=96&r=pg","caption":"Packt Publishing"},"description":"Hi, I'm Jude from Packt Publishing. We have a wide range of books covering various technologies such as Open Source and Enterprise. http:\/\/www.packtpub.com\/","sameAs":["http:\/\/www.packtpub.com\/"],"url":"https:\/\/www.andysowards.com\/blog\/author\/packtpublishing\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.andysowards.com\/blog\/wp-json\/wp\/v2\/posts\/1942"}],"collection":[{"href":"https:\/\/www.andysowards.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.andysowards.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.andysowards.com\/blog\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.andysowards.com\/blog\/wp-json\/wp\/v2\/comments?post=1942"}],"version-history":[{"count":0,"href":"https:\/\/www.andysowards.com\/blog\/wp-json\/wp\/v2\/posts\/1942\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.andysowards.com\/blog\/wp-json\/wp\/v2\/media?parent=1942"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.andysowards.com\/blog\/wp-json\/wp\/v2\/categories?post=1942"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.andysowards.com\/blog\/wp-json\/wp\/v2\/tags?post=1942"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}