是否可以禁用使用拖動在Carousel面板之間切換? 我想用指標。禁用在Carousel中拖動
5
A
回答
1
嘗試倍率AfterRender階段在旋轉木馬方法;(I除去上兒童的方法拖拽事件)
afterRender : function() {
Ext.Carousel.superclass.afterRender.call(this);
this.mon(this.body, {
direction : this.direction,
scope : this
});
this.el.addCls(this.baseCls + "-" + this.direction)
}
全體的代碼;
this.car = new Ext.Carousel({
ui : 'light',
items: [
{
html: '<p>Carousels can be vertical and given a ui of "light" or "dark".</p>',
cls : 'card card1'
},
{
html: 'Card #2',
cls : 'card card2'
},
{
html: 'Card #3',
cls : 'card card3'
}],
afterRender : function() {
Ext.Carousel.superclass.afterRender.call(this);
this.mon(this.body, {
direction : this.direction,
scope : this
});
this.el.addCls(this.baseCls + "-" + this.direction)
}
});
10
只爲Sencha Touch 2.0用戶拋出這個問題。上述解決方案不適用於Sencha Touch 2.0,但有一個相當簡單的解決方法。
Ext.define('Ext.LockableCarousel', {
extend: 'Ext.Carousel',
id: 'WelcomeCarousel',
initialize: function() {
this.onDragOrig = this.onDrag;
this.onDrag = function (e) { if(!this.locked){this.onDragOrig(e);} }
},
locked: false,
lock: function() { this.locked = true; },
unlock: function() { this.locked = false; }
});
這將完全像旋轉木馬一樣運行,除非現在您可以調用.lock和.unlock。所以你可以這樣做:
Ext.Viewport.add(Ext.create('Ext.LockableCarousel', {
id: 'LockableCarousel',
fullscreen: true,
hidden: false,
items: [
{
html : 'Item 1',
style: 'background-color: #5E99CC'
},
{
html : '<a href="#" onclick="Ext.getCmp(\'LockableCarousel\').lock();">Lock</a><br /><a href="#" onclick="Ext.getCmp(\'LockableCarousel\').unlock();">Unlock</a>',
style: 'background-color: #759E60'
}
]
}));
相關問題
- 1. jquery禁用拖動
- 2. GWT:在DialogBox中禁用拖動
- 3. 在QListView中禁用拖動圖像
- 4. 需要禁用在jScrollPane中拖動
- 5. 在DroidGap中禁用屏幕拖動
- 6. 在JTable中禁用單個列拖動
- 7. JS禁用拖放(可拖動屬性)
- 8. JTable中,禁用用戶列拖動
- 9. 禁用/啓用可拖動jQuery中
- 10. 試圖禁用拖動JInternalFrame
- 11. 禁用全窗口拖動
- 12. 如何禁用BottomSheetDialogFragment拖動
- 13. jsTree - 禁用拖動選項
- 14. 通過拖動滾動條保持裝置在Touch Carousel中移動傳送帶
- 15. 在拖動可拖動項目的內容時禁用jQuery拖動
- 16. 禁用僅在「body」元素上拖動?
- 17. 如何在拖動時禁用光標?
- 18. jquery scrollTo()在鉻禁用鼠標拖動
- 19. 拖動移動時禁用滾動
- 20. 禁止在MPAndroidChart中拖動PieChart
- 21. 禁用滾動,但在iPhone中啓用拖動
- 22. 的jQuery拖動滾動禁用
- 23. 通過拖動禁用滾動
- 24. 禁用水平拖動滾動
- 25. 禁用RecyclerView項目拖動的振動
- 26. GWT禁用水平拖動滾動
- 27. Ionic2禁用垂直滑動/拖動?
- 28. jquery,禁用拖放在另一個可拖動的頂部
- 29. 如何禁用拖放可拖動div的拖放?
- 30. 在Bootstrap Carousel中禁用的空格鍵Slide
謝謝,它的工作原理。但我不確定它是如何做的:)你能解釋一下嗎? – Egor4eg
當然。想法很簡單。我們必須禁用拖動,在這種情況下,可以通過移除拖動監聽器來進行拖動。在sencha-touch.js中的afterRender方法中添加拖動偵聽器。我們重寫afterRender方法,因此sencha-touch的afterRender方法不會運行,我們的新方法將運行,並且我們的方法不會添加拖拽偵聽器。我希望這個描述很清楚。 :) –
謝謝,我明白了。 – Egor4eg