I am using jquery and jstree to load the tree and based on the node_id, display images on divs. It works ok but sometimes, some images are not showing on the first click and shows up on the second click. This is not really good for the end user. How would I get around this problem; here is my code:
- (document).ready(function(){
- $("#left").jstree({
-
- "xml_data" : {
- "ajax" : {
- "url" : "tree.xml"
},
- "xsl" : "nest"
- },
"plugins" : ["themes", "xml_data", "ui","types"]
}).bind("select_node.jstree", function (event, data) {
var node_id = data.rslt.obj.attr("id");
-
if (node_id.indexOf("TEAM")>=0)
var teamA;
var teamB;
teamA = "image/"+node_id+"-scores.png";
teamB="image/"+node_id+"-standing.png";
img1 = new Image;
img1.src=teamA;
- img2 = new Image;
img2.src= teamB;
$("#div1").html(img1);
$("#div2").html(img2);
});