Monday, August 27, 2012

javascript – Highlight empty space between words in jQuery

I\’m new in jQuery so i have 2 questions.


1-How can I highlight empty space between words in this function?


2-How can I highlight just <abbr class=\"word p1\"> tag?


HTML Code:



<span id=\"4\">
<abbr class=\"word p1\" >ﭢ</abbr>
<abbr class=\"word p1\" >ﭣ</abbr>
<abbr class=\"word p1\" >ﭤ</abbr>
<abbr class=\"word p1\" >ﭥ</abbr>
<abbr class=\"end p1\" >ﭦ</abbr>
</span >


JavaScript Code:



$(function(){
var time = 5;
$(\"abbr\", \"#4\").each(function(i,e) {
$(e).delay(i*((time*1000)/$(\"abbr\", \"#4\").length)).animate({\'background-color\': \'#0f0\'}, 500);
});
});​


Css Code:



span
{
text-align:justify;
float:right;
}

@font-face {
font-family: \'p1\';
src: url(\'http://c216429.r29.cf1.rackcdn.com/p1.eot?#iefix\') format(\'embedded- opentype\'),
url(\'http://c216429.r29.cf1.rackcdn.com/p1.woff\') format(\'woff\'),
url(\'http://c216429.r29.cf1.rackcdn.com/p1.ttf\') format(\'truetype\'),
url(\'http://c216429.r29.cf1.rackcdn.com/p1.svg#p1\') format(\'svg\');
}

.p1 {
font-family: \'p1\';
}​


Demo:

http://jsfiddle.net/eTyaV/






Rating: 4 out of 5 based on 3 ratings



The post javascript – Highlight empty space between words in jQuery appeared first on Javascript ASK.






via Javascript ASK http://javascriptask.phpfogapp.com/javascript-highlight-empty-space-between-words-in-jquery.html

No comments:

Post a Comment