render() {
        this.reset()
        if (this.type === "int") {
            // Int Button
            for (let i = this.int_range[0]; i <= this.int_range[1]; i++) {
                let newButton = document.createElement('div')
                let innerHTML = `${i}`
                if (this.selected_value === i) {
                    newButton.innerHTML = `${this.selected_button_style}${innerHTML}`
                    newButton.classList.add("selected_element")
                }
                else {
                    newButton.innerHTML = `${innerHTML}`
                    newButton.addEventListener('click', (e) => {
                        this.selected_value = parseInt(e.target.innerHTML)
                        this.dispatchEvent(this.event_selected_value_changed)
                        this.render()
                    })
                }
                this.buttons.push(newButton)
                this.slider.appendChild(newButton)
            }
            let range = this.int_start - this.int_range[0]
            this.slider.scrollTo(0, 50*range - 50)
        }
        else {
            // Classic String Button
            for (let i = 0; i < this.elements.length; i++) {
                let newButton = document.createElement('div')
                let innerHTML = `${this.elements[i]}`
                if (this.selected_value === this.elements[i]) {
                    newButton.innerHTML = `${this.selected_button_style}${innerHTML}`
                    newButton.classList.add("selected_element")
                }
                else {
                    newButton.innerHTML = `${innerHTML}`
                    newButton.addEventListener('click', (e) => {
                        this.selected_value = e.target.innerHTML
                        this.dispatchEvent(this.event_selected_value_changed)
                        this.render()
                    })
                }
                this.buttons.push(newButton)
                this.slider.appendChild(newButton)
                this.slider.scrollTo(0, 50*this.int_start - 50)
            }
        }
        if (this.hide_scrollbar) {
            this.slider.classList.add("gus_slider_noscrollbar")
        }
    }
// Re-render the whole slider
Re-render the whole slider
Re - render the whole slider
render() {
        this.reset()
        if (this.type === "int") {
            for (let i = this.int_range[0]; i <= this.int_range[1]; i++) {
                let newButton = document.createElement('div')
                let innerHTML = `${i}`
                if (this.selected_value === i) {
                    newButton.innerHTML = `${this.selected_button_style}${innerHTML}`
                    newButton.classList.add("selected_element")
                }
                else {
                    newButton.innerHTML = `${innerHTML}`
                    newButton.addEventListener('click', (e) => {
                        this.selected_value = parseInt(e.target.innerHTML)
                        this.dispatchEvent(this.event_selected_value_changed)
                        this.render()
                    })
                }
                this.buttons.push(newButton)
                this.slider.appendChild(newButton)
            }
            let range = this.int_start - this.int_range[0]
            this.slider.scrollTo(0, 50*range - 50)
        }
        else {
            for (let i = 0; i < this.elements.length; i++) {
                let newButton = document.createElement('div')
                let innerHTML = `${this.elements[i]}`
                if (this.selected_value === this.elements[i]) {
                    newButton.innerHTML = `${this.selected_button_style}${innerHTML}`
                    newButton.classList.add("selected_element")
                }
                else {
                    newButton.innerHTML = `${innerHTML}`
                    newButton.addEventListener('click', (e) => {
                        this.selected_value = e.target.innerHTML
                        this.dispatchEvent(this.event_selected_value_changed)
                        this.render()
                    })
                }
                this.buttons.push(newButton)
                this.slider.appendChild(newButton)
                this.slider.scrollTo(0, 50*this.int_start - 50)
            }
        }
        if (this.hide_scrollbar) {
            this.slider.classList.add("gus_slider_noscrollbar")
        }
    }
render ( ) { this . reset ( ) if ( this . type === "int" ) { for ( let i = this . int_range [ 0 ] ; i <= this . int_range [ 1 ] ; i ++ ) { let newButton = document . createElement ( 'div' ) let innerHTML = ` ${ i } ` if ( this . selected_value === i ) { newButton . innerHTML = ` ${ this . selected_button_style } ${ innerHTML } ` newButton . classList . add ( "selected_element" ) } else { newButton . innerHTML = ` ${ innerHTML } ` newButton . addEventListener ( 'click' , ( e ) => { this . selected_value = parseInt ( e . target . innerHTML ) this . dispatchEvent ( this . event_selected_value_changed ) this . render ( ) } ) } this . buttons . push ( newButton ) this . slider . appendChild ( newButton ) } let range = this . int_start - this . int_range [ 0 ] this . slider . scrollTo ( 0 , 50 * range - 50 ) } else { for ( let i = 0 ; i < this . elements . length ; i ++ ) { let newButton = document . createElement ( 'div' ) let innerHTML = ` ${ this . elements [ i ] } ` if ( this . selected_value === this . elements [ i ] ) { newButton . innerHTML = ` ${ this . selected_button_style } ${ innerHTML } ` newButton . classList . add ( "selected_element" ) } else { newButton . innerHTML = ` ${ innerHTML } ` newButton . addEventListener ( 'click' , ( e ) => { this . selected_value = e . target . innerHTML this . dispatchEvent ( this . event_selected_value_changed ) this . render ( ) } ) } this . buttons . push ( newButton ) this . slider . appendChild ( newButton ) this . slider . scrollTo ( 0 , 50 * this . int_start - 50 ) } } if ( this . hide_scrollbar ) { this . slider . classList . add ( "gus_slider_noscrollbar" ) } }
Re-render the whole slider
Re - render the whole slider
// Int Button // Classic String Button