Tutorial :using jquery highlight effect



Question:

I would like to use jquery highlight effect to highlight a paragraph with background orange, then when completed, turn on orange background permanently. In this code the second task does not work.

myparagrah = $("#thisParagraph");    turnOrangeOnWarning("This is a warning!");    function turnOrangeOnWarning(t) {               myparagrah.text(t).effect("highlight",{'color':'orange'},1000);           myparagrah.css("background-color","orange");                        }  


Solution:1

your function has it calling the second line immediately after the first. I imagine it is turning orange instantly, rather that a one second highlight that you want. You need to make the second line a callback to your first. Might look something like this (not sure what the correct effect() overload parameters are):

function turnOrangeOnWarning(t) {      myparagraph.text(t).effect("highlight", {'color':'orange'}, 1000,          function() { myparagraph.css("background-color", "orange"); }      );  }  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »