문제

I am trying to implement a tag cloud like Amazon.co.uk see here. my currenct javascript is like this

var tags = jq.getJSON(baseUrl + '/ajax/populartags', null, function(json){
    //create list for tag links
    jq("<p>").attr("id", "popularTagsList").appendTo("#tagCloud");
    //create tags
    jq.each(json, function(i, val) {
        //create link
        a = jq("<a>").text(val.Tag).attr({title:"See all pages tagged with " + val.Tag, href:baseUrl + '/item/tag/' + val.Tag});
        a.css("fontSize", (val.Count / 10 < 1) ? val.Count / 10 + 1 + "em": (val.Count / 10 > 4) ? "4em" : val.Count / 10 + "em");

        //add to list
        a.appendTo("#popularTagsList");
    });
});

is it possible to add ligten/darken functionality to this code?

도움이 되었습니까?

해결책

I think the approach to take would be to adjust the color. In order to "lighten" the color, increase the value for each of RGB components of that color. To "darken" it, decrease the values. If that doesn't make sense or if you'd like a detailed code sample, post a comment and I'll get back with an update shortly.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top