2012-12-03 144 views
0

我正在設置帶有標籤和規則的dijit.form.HorizontalSlider,我無法使顯示器正常工作。滑塊顯示在規則和標籤的頂部。我可以看到,標籤和規則被放置的div沒有高度屬性,我猜這就是我的問題,但我似乎無法修復它。Dojo Horizo​​ntal Slider在標籤上顯示

下面的代碼...

//create a div for the rule in my inner node div 
this.ruleDiv = dojo.create("div", {}, dojo.byId("ruleDiv"), "first"); 
this.getInnerNode().appendChild(this.ruleDiv); 

//create a div for the labels in my inner node div 
this.labelsDiv = dojo.create("div", {},dojo.byId("labelsDiv"), "first"); 
this.getInnerNode().appendChild(this.labelsDiv); 

//create the rule object 
this.sliderLabelsRule = new HorizontalRule({ 
    container: "topDecoration", 
    count: 10 
}, this.getLabelsRuleDiv()); 

//create the labels object 
this.sliderLabels = new HorizontalRuleLabels({ 
    container: "topDecoration", 
    labelStyle: "font-size: 10px;", 
    labels: ["test0", "test1", "test2", "test3", "test4", "test5", 
      "test6", "test7", "test8", "test9"] 
}, this.getLabelsDiv()); 

//create the slider 
this.slider = new Slider({}, this.getInnerNode()); 

//startup the widgets 
this.getSlider().startup(); 
this.getLabelsRule().startup(); 
this.getLabels().startup(); 

我試着換周圍的東西,這個嘗試一堆不同的方式,但我似乎無法找到正確的組合,任何幫助表示讚賞!

回答

1

在您的Horizo​​ntalRule構造函數中,添加一個樣式屬性來設置高度。像這樣的東西。

this.sliderLabelsRule = new HorizontalRule({ 
    container: "topDecoration", 
    count: 10, 
    style: "height: 5px;" 
}, this.getLabelsRuleDiv()); 

我也有類似的問題,即我的所有標籤和規章制度下的滑塊也可直接堆放在彼此的頂部,這樣我有十個標籤和一個大混亂的規則,我必須設置寬度上述構造函數的寬度與我的滑塊相同,並使用position:absolute將它們移動到正確的位置。爲了讓他們到達你想要的位置,你可能需要做類似的事情。只需在構造函數的style屬性中使用css

+0

男人,我可以像一年前一樣使用你。我不知道我是否能夠解決這個問題,因爲在項目結束的時候我已經接近尾聲了,而且我從那以後就開始了。我會給你正確的答案,因爲它是有道理的,希望它能在將來幫助別人。 – Shaded

+0

謝謝,是的,我今天真的遇到了這個問題,當找到一個答案發現這個,所以一旦我終於想通了,我想我不妨將它發佈在這裏供將來參考 –

相關問題