Here's the HTML element that I'm working with:
<div id="scrollbar" style="background-color: #000;"
v-bind:style="{ height : scrollbarheight + 'px' }"
></div>
I have been attempting to adjust the height using the following code:
let scrollbarheight = 30
function jsonMSG(msg) {
const cmd = JSON.parse(msg)
console.log('CMD: ', cmd.height)
const h = Math.round(cmd.height / 1024)
scrollbarheight = h
}
function webSocketOnMSG(msg) {
if (typeof (msg.data) === 'string') {
jsonMSG(msg.data)
return
}
}
data() {
return {
scrollbarheight
...
}
}
created() {
console.log('Starting Connection to WebSocket')
this.connection = new WebSocket('ws://127.0.0.1:8080/')
// this.connection = new WebSocket('ws://echo.websocket.org')
this.connection.onopen = function (event) {
console.log(event)
console.log('Success')
}
this.connection.onmessage = webSocketOnMSG
}
However, it seems like my attempts are not successful.
Additionally, I am curious about how I can implement a smooth vertical dragging functionality on the div (similar to a scrollbar).