refactor tabs
This commit is contained in:
		
							parent
							
								
									eded0eb19c
								
							
						
					
					
						commit
						33bd730576
					
				
							
								
								
									
										10
									
								
								lib/tabs.js
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								lib/tabs.js
									
									
									
									
									
								
							| @ -7,15 +7,19 @@ define([], function () { | ||||
| 
 | ||||
|     var container = document.createElement("div") | ||||
| 
 | ||||
|     function switchTab() { | ||||
|     function gotoTab(li) { | ||||
|       for (var i = 0; i < tabs.children.length; i++) { | ||||
|         var el = tabs.children[i] | ||||
|         el.classList.remove("visible") | ||||
|         el.tab.classList.remove("visible") | ||||
|       } | ||||
| 
 | ||||
|       this.classList.add("visible") | ||||
|       this.tab.classList.add("visible") | ||||
|       li.classList.add("visible") | ||||
|       li.tab.classList.add("visible") | ||||
|     } | ||||
| 
 | ||||
|     function switchTab() { | ||||
|       gotoTab(this) | ||||
| 
 | ||||
|       return false | ||||
|     } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user