Page 1 of 1

Change Z-index of window when click on task bar icon

Posted: Mon Sep 17, 2018 10:28 pm
by ferbonfim
hi every one, i add this code on project and i dont know where share my changes,

on desktop.js i change this

Code: Select all

 addToTaskBar: function(wnd){
        var icon = wnd.getIcon();
        var wID = wnd.win.attr("id");
        //add id to reffer window
        var item = $("<span id='T_"+wID+"' >").addClass("task-bar-item started").html(icon);

        item.data("wID", wID);

        item.appendTo($(this.options.taskBar));
    },

    removeFromTaskBar: function(wnd){
        console.log(wnd);
        var wID = wnd.attr("id");
        var items = $(".task-bar-item");
        var that = this;
        $.each(items, function(){
            var item = $(this);
            //to remove icon on task (some times the icon on task bar dont remove, and this solve)
            if (item.attr("id") === 'T_'+wID) {
                delete that.wins[wID];
                item.remove();
            }
        })
    },
and i make this function :

Code: Select all

    $(document).on('click', '.task-bar-item.started', function () {
    	var id = $(this).attr('id');

    	id = id.replace('T_','');

    	$.each($('.window'), function(){
		$(this).css("z-index", 1);
	})
	  
	  $("#"+id).css("z-index", 2);
	});