You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							20 lines
						
					
					
						
							434 B
						
					
					
				
			
		
		
	
	
							20 lines
						
					
					
						
							434 B
						
					
					
				| import isWindow from './isWindow';
 | |
| export default function getscrollAccessor(offset) {
 | |
|   var prop = offset === 'pageXOffset' ? 'scrollLeft' : 'scrollTop';
 | |
| 
 | |
|   function scrollAccessor(node, val) {
 | |
|     var win = isWindow(node);
 | |
| 
 | |
|     if (val === undefined) {
 | |
|       return win ? win[offset] : node[prop];
 | |
|     }
 | |
| 
 | |
|     if (win) {
 | |
|       win.scrollTo(win[offset], val);
 | |
|     } else {
 | |
|       node[prop] = val;
 | |
|     }
 | |
|   }
 | |
| 
 | |
|   return scrollAccessor;
 | |
| } |