javascript - Change element in each JQuery tab to dynamically generated colors -



javascript - Change element in each JQuery tab to dynamically generated colors -

i'm using jquery ui tabs widget , have button add together additional tabs. i'm tying each tab markers on map coordinating randomly generated color using

function gen_color() { homecoming '#'+(math.random()*0xffffff<<0).tostring(16); }

so each tab has color corresponds number of markers of same color on map.

i'm trying add together 15x15 block of color within tab's tab left of it's label. right i'm using tabtemplate alternative , trying alter when new tab added:

$tabs = $("#tabs").tabs({ tabtemplate: "<li><span class='ui-icon-color' style='background-color:#000000;'></span><a href='#{href}'>#{label}</a> <span class='ui-icon ui-icon-close'>remove tab</span></li>", selected: 0, add: function( event, ui ) { var tab_content = "search " + tab_counter; //add panel $("#searchtemplate").tmpl().appendto(ui.panel); ui.tab.css({"background-color":'"'+gen_color()+'"'}); } });

which uses next css:

#tabs li .ui-icon-color { float: left; width:15px; height:15px; margin-top: 0.4em; margin-right: 0.4em; margin-bottom: 0.4em; margin-left: 0.4em;}

however, doesn't seem update anything. i'm not sure if i'm getting css wrong, or somehow need "refresh" tab, or if there's much improve way this? help appreciated.

javascript jquery css dynamic tabs

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -