tabs: don't reset value when activating active tab (otherwise scrolling is reset to)
This commit is contained in:
parent
1be9cecaa7
commit
c4f590ec15
2 changed files with 19 additions and 13 deletions
|
|
@ -59,7 +59,7 @@ module.exports = class Panel extends _widgets_base {
|
|||
if (this.getProp('tabs') && this.getProp('tabs').length) this.widget.addClass('has-tabs')
|
||||
|
||||
|
||||
this.value = this.getProp('value') || 0
|
||||
this.value = -1
|
||||
this.tabs = []
|
||||
|
||||
var parsers = require('../../parser'),
|
||||
|
|
@ -93,6 +93,7 @@ module.exports = class Panel extends _widgets_base {
|
|||
|
||||
}
|
||||
|
||||
this.setValue(this.getProp('value') || 0)
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -175,18 +176,22 @@ module.exports = class Panel extends _widgets_base {
|
|||
setValue(v, options={}) {
|
||||
if (this.tabs.length && typeof v == 'number' && v >= 0 && v < this.tabs.length) {
|
||||
|
||||
for (let i in this.tabs) {
|
||||
if (v != this.value) {
|
||||
|
||||
for (let i in this.tabs) {
|
||||
|
||||
this.tabs[i].hide()
|
||||
}
|
||||
|
||||
this.tabs[v].show()
|
||||
|
||||
this.navigation.find('li').removeClass('on').eq(v).addClass('on')
|
||||
this.value = v
|
||||
|
||||
$(window).resize()
|
||||
|
||||
this.tabs[i].hide()
|
||||
}
|
||||
|
||||
this.tabs[v].show()
|
||||
|
||||
this.navigation.find('li').removeClass('on').eq(v).addClass('on')
|
||||
this.value = v
|
||||
|
||||
$(window).resize()
|
||||
|
||||
if (options.send) this.sendValue()
|
||||
if (options.sync) this.widget.trigger({type:'change',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue