Moving Suggestion box up over the fivem/rp chat

Hi
I would like to move my suggestions box from the bottom of the chat to the top of the chat.
So I wanted to hear if there are any who have an idea of ​​what it could be, as I think I have soon tried everything to move it up.

I use the normal chat system that comes with each vrp server.

What you can see here is a demonstration of what I would like it to be

This is what my code looks like

HTML:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title></title>
  <link href="vendor/latofonts.css" rel="stylesheet">
  <link href="vendor/flexboxgrid.6.3.1.min.css" rel="stylesheet"></link>
  <link href="vendor/animate.3.5.2.min.css" rel="stylesheet"></link>
  <link href="index.css" rel="stylesheet"></link>

  <script src="vendor/vue.2.3.3.min.js" type="text/javascript"></script>
  <script src="config.default.js" type="text/javascript"></script>
  <script src="config.js" type="text/javascript"></script>
</head>
<body>
  <div id="app"></div>

<!-- Suggestions Template -->
  <script type="text/x-template" id="suggestions_template">
    <ul class="suggestions" v-show="currentSuggestions.length > 0">
      <li class="suggestion" v-for="s in currentSuggestions">
        <p>
          <span :class="{ 'disabled': s.disabled }">
            {{s.name}}
          </span>
          <span class="param"
                v-for="(p, index) in s.params"
                :class="{ 'disabled': p.disabled }">
            [{{p.name}}]
          </span>
        </p>
        <small class="help">
          <template v-if="!s.disabled">
            {{s.help}}
          </template>
          <template v-for="p in s.params" v-if="!p.disabled">
            {{p.help}}
          </template>
        </small>
      </li>
    </ul>
  </script>

  <!-- App Template -->
  <script type="text/x-template" id="app_template">
    <div id="app">
      <div class="chat-window" :style="this.style" :class="{ 'fadeOut animated': !showWindow }">
        <div class="chat-messages" ref="messages">
          <message v-for="msg in messages"
                   :templates="templates"
                   :multiline="msg.multiline"
                   :args="msg.args"
                   :color="msg.color"
                   :template="msg.template"
                   :template-id="msg.templateId"
                   :key="msg">
          </message>
        </div>
      </div>
      <div class="chat-input" v-show="showInput">
        <textarea v-model="message"
                  ref="input"
                  type="text"
                  autofocus
                  spellcheck="false"
                  @keyup.esc="hideInput"
                  @keyup="keyUp"
                  @keydown="keyDown"
                  @keypress.enter.prevent="send">
        </textarea>
        <suggestions :message="message" :suggestions="suggestions">
        </suggestions>
      </div>
    </div>
  </script>
  
  <!-- Message Template -->
  <script type="text/x-template" id="message_template">
    <div class="msg" :class="{ multiline }">
      <span v-html="textEscaped"></span>
    </div>
  </script>

  <!-- Scripts -->
  <script type="text/javascript" src="./Suggestions.js"></script>
  <script type="text/javascript" src="./Message.js"></script>
  <script type="text/javascript" src="./App.js"></script>

  <!-- Main Entry -->
  <script type="text/javascript">
  window.post = (url, data) => {
    var request = new XMLHttpRequest();
    request.open('POST', url, true);
    request.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
    request.send(data);
  }

  const instance = new Vue({
    el: '#app',
    render: h => h(APP),
  });

  window.emulate = (type, detail = {}) => {
    detail.type = type;
    window.dispatchEvent(new CustomEvent('message', {
      detail,
    }));
  };
  </script>

</body>
</html>
```
CSS: 
```
.color-0{color: #ffffff;}
.color-1{color: #ff4444;}
.color-2{color: #99cc00;}
.color-3{color: #ffbb33;}
.color-4{color: #0099cc;}
.color-5{color: #33b5e5;}
.color-6{color: #aa66cc;}
.color-8{color: #cc0000;}
.color-9{color: #cc0068;}

* {
  font-family: 'Lato', sans-serif;
  margin: 0;
  padding: 0;
}

.no-grow {
  flex-grow: 0;
}

em {
  font-style: normal;
}

#app {
  font-family: 'Lato', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: white;
}

.chat-window {
  position: absolute;
  top: 15px;
  left: 15px;
  width: 38%;
  height: 240px;

  background-color: rgba(52, 73, 94, 0.7);
  -webkit-animation-duration: 2s;
}


.chat-messages {
  position: relative;
  height: 95%;
  font-size: 14px;
  margin: 10px;
  text-shadow: 1px 0 0 #000, -1px 0 0 #000, 0 1px 0 #000, 0 -1px 0 #000, 1px 1px #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;

  overflow-x: hidden;
  overflow-y: hidden;
}


.chat-input {
  font-size: 1.1rem;
  position: absolute;
  background: rgba(0, 0, 0, 0.350);
  /*background: rgba(191, 191, 191, 0.2);*/
  top: 95%;
  right: 33%;
  width: 38%;
  max-width: 610px;
  /*border: 2px solid rgba(191, 191, 191, 0.2); */
  /*border-radius: 5px;*/
  box-sizing: border-box;
}

.prefix {
  position: absolute;
  font-size: 14px;
  margin-top: 5.5px;
  left: 4px;
}

textarea {
  font-size: 1.1rem;
  display: block;
  box-sizing: border-box;
  padding: 5px;
  padding-left: 10px;
  top: -1px;
  color: white; 
  background-color: rgba(44, 62, 80, 0.0);
  width: 100%;
  border-width: 0;
  height: 34px;
  overflow: hidden;
}

textarea:focus, input:focus {
    outline: none;
}

.msg {
  margin-bottom: 3px;
}

.multiline {
  margin-left: 1.5rem;
  text-indent: -1.5rem;
  white-space: pre-line;
}

.suggestions {
  list-style-type: none;
  padding: 5px;
  padding-left: 27px;
  font-size: 1.1rem;
  box-sizing: border-box;
  color: white;
  /*background-color: rgba(44, 62, 80, 1.0);*/
  border: 2px solid rgba(191, 191, 191, 0.61);
  background-color: rgba(0, 0, 0, 0.350);
  width: 100%;
}

.help {
  color: #b0bbbd;
}

.disabled {
  color: #b0bbbd;
}

.suggestion {
  margin-top: 5px;
}
```
Hope someone can help as it is a problem that has been going on for a while now.

Try moving the suggestions element above the chat-input.

image

Then adjust the CSS for .suggestions as needed to make sure it’s displayed nicely.

1 Like