File tree 1 file changed +11
-2
lines changed 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 17
17
}
18
18
}
19
19
20
+ /** Selects a random item from an array **/
20
21
function pick ( items ) {
21
22
return items [ Math . floor ( Math . random ( ) * items . length ) ] ;
22
23
}
123
124
this . container . style . width = `${ ( width * count ) } px` ;
124
125
125
126
let index = 0 ;
127
+ let selected = undefined ;
128
+ let selectedLeft = undefined ;
126
129
for ( const child of [ ...this . container . children ] ) {
130
+ if ( child . matches ( ".selected" ) ) {
131
+ selected = child ;
132
+ selectedLeft = index * width ;
133
+ }
127
134
console . log ( child ) ;
128
135
child . style . left = `${ index * width } px` ;
129
136
++ index ;
130
137
}
138
+
139
+ this . scroller . scroll ( { left : selectedLeft , behavior : "instant" } ) ;
131
140
}
132
141
133
142
contract ( ) {
320
329
`
321
330
;
322
331
323
- document . querySelector ( ".copyText" ) . onclick = ( ) => copyText ( text ) ;
332
+ document . querySelector ( ".copyText" ) . onclick = ( ) => copyText ( text ) ;
324
333
} ) ( ) ;
325
334
</ script >
326
335
< style >
391
400
display : block;
392
401
width : var (--width );
393
402
height : var (--height );
394
- transition : width 0.6s ease;
403
+ /* transition: width 0.6s ease; */
395
404
}
396
405
397
406
expand-children > .scroller > .container > * {
You can’t perform that action at this time.
0 commit comments