cosmicsea
01-11-2011, 05:13 AM
Hello I am not very familliar with javascript but i have this little code snippet
$(function(){
$('input').click(function(){
var ourText = $('ul');
var currFontSize = ourText.css('fontSize');
var finalNum = parseFloat(currFontSize, 10);
var stringEnding = currFontSize.slice(-2);
if(this.id == 'large') {
finalNum *= 1.2;
}
else if (this.id == 'small'){
finalNum /=1.2;
}
ourText.animate({fontSize: finalNum + stringEnding},600);
});
});
and it enables you to make the font size larger or smaller for an element. It works perfectly but what I want it to do is only work on one element at a time. I want to put this on a search result page and be able to make the text larger or smaller for any individual result. Is this possible. I have all the text in the ul tag. and several instances of the ul tag. I want this to display on each result which it currently will but if I change the font size on one it changes all. Is there a way to stop that? thanks.
By the way I found this at
http://dev-tips.com/featured/jquery-tip-font-resizing-with-animation-effects
if that helps.
$(function(){
$('input').click(function(){
var ourText = $('ul');
var currFontSize = ourText.css('fontSize');
var finalNum = parseFloat(currFontSize, 10);
var stringEnding = currFontSize.slice(-2);
if(this.id == 'large') {
finalNum *= 1.2;
}
else if (this.id == 'small'){
finalNum /=1.2;
}
ourText.animate({fontSize: finalNum + stringEnding},600);
});
});
and it enables you to make the font size larger or smaller for an element. It works perfectly but what I want it to do is only work on one element at a time. I want to put this on a search result page and be able to make the text larger or smaller for any individual result. Is this possible. I have all the text in the ul tag. and several instances of the ul tag. I want this to display on each result which it currently will but if I change the font size on one it changes all. Is there a way to stop that? thanks.
By the way I found this at
http://dev-tips.com/featured/jquery-tip-font-resizing-with-animation-effects
if that helps.