0
的顏色在煎茶觸摸2個應用,我使用的是導航欄動態更改導航欄
var homeNavigation = {
extend: 'Ext.navigation.View',
xtype : 'homeView',
config : {
autoDestroy: false,
iconCls : 'homeicon',
title : 'Home',
navigationBar: {
items: [
myInfoButton,
addButton
]
},
items: [
{
xtype : 'homeIndexView'
}
]
}
};
Ext.define('MyAPP.view.Home', homeNavigation);
我需要改變它的顏色爲紅色漸變。
對於我做了以下是CSS表:
.x-toolbar-dar {
background-image: none;
background-color: #5a000b;
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #b98182), color-stop(50%, #781a2c), color-stop(51%, #5a000b), color-stop(100%, #4a020e));
background-image: -webkit-linear-gradient(top, #b98182, #781a2c 50%, #5a000b 51%, #4a020e);
background-image: linear-gradient(top, #b98182, #781a2c 50%, #5a000b 51%, #4a020e);
border-color: #4a020e;
}
其正常工作和導航欄有想要的顏色。
問題
我需要改變它的顏色dynamicallym這就是我有問題。我需要checge它的顏色,當一個視圖導航
推在我創造了這個功能的控制器:
applyThemeToNavigationBar : function() {
$(".x-toolbar-dark").css({
"backgroundImage": "none",
"backgroundColor": "#5a000b",
"backgroundImage": "-webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #b98182), color-stop(50%, #781a2c), color-stop(51%, #5a000b), color-stop(100%, #4a020e))",
"backgroundImage": "-webkit-linear-gradient(top, #b98182, #781a2c 50%, #5a000b 51%, #4a020e)",
"backgroundImage": "linear-gradient(top, #b98182, #781a2c 50%, #5a000b 51%, #4a020e)",
"backgroundColor": "#4a020e"
});
}
並在View的推送事件:push : 'onViewPush'
我調用了上述函數更改CSS:
onViewPush: function(view, item) {
applyThemeToNavigationBar();
alert('theme changed');
}
當按下視圖但導航視圖不改變顏色時,將調用alert('them changed')。
感謝所有幫助
這個$從哪裏來?你也有jQuery?你也有任何控制檯中的錯誤? –
是的,我有jquery並正常使用它。控制檯中沒有錯誤。它試圖提醒'$(「。x-toolbar-dark」)。length我得到5,這意味着對象被定義,而不是null – Youssef