Ensure the simulated JavaScript terminal window remains in a static position on the webpage

Hi there! I've recently started learning JavaScript and CSS by working on a project where I've combined some code I forked with my own ideas. You can check out the page I'm working on here: web page for learning. However, I've run into an issue. I'm using a JavaScript script called "jsterm" that emulates a terminal interface. At the bottom of the page, I have a box with share options and flairs. I want to make this box "static" so that the jsterm terminal doesn't go beneath it. Where should I start in fixing this? I've already tried adjusting the height value in the CSS, but the jsterm still covers the entire page.

div.jsterm {
background: black;
font-family: monospace;
font-size: 16px;
color: #E0E0E0;
top:0%;
left:0%;
width: 100%;
height: 100px;
margin-bottom: 20px;
white-space: pre-wrap;
}

.share_box{
display: inline;
position:fixed;
height: 10%;
width:100%;
bottom:0%;
left:0%;
border:3px solid #a1a1a1;
background:#FFF;
padding:15px;
}

Here's the HTML structure:

<!doctype html>
   <html>
     <head>
       <title>Erik Sorensen</title>
       <link rel="shortcut icon" href="/images/favicon.ico">
       <meta name="description" content="Erik's webpage">
       <link type="text/css" rel="stylesheet" href="/css/style.css">
    </head>
    <body>
      <div class='cmd_box'>
         <script type="text/javascript" src="/commands/com1.js"></script>
         <script type="text/javascript" src="/config/config.js"></script>
         <script type="text/javascript" src="/js/jsterm.js"></script>
      </div>
      <div class="share_box">
        <!-- Twitter -->
        <a href="http://twitter.com/share" class="twitter-share-button" data-count="vertical" data-via="eriksor">Tweet</a>
        <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
        <!-- Google + -->
        <g:plusone size="tall"></g:plusone>    
          <script type="text/javascript">
            (function() {
              var po = document.createElement('script'); 
              po.type = 'text/javascript'; 
              po.async = true;
              po.src = 'https://apis.google.com/js/plusone.js';
              var s = document.getElementsByTagName('script')[0]; 
              s.parentNode.insertBefore(po, s);
            })();
          </script>
        <!--Stackoverflow flair -->
        <a href="http://stackoverflow.com/users/2394561/eriksorensen">
          <img src="http://stackoverflow.com/users/flair/2394561.png" width="208" height="58" alt="profile for ErikSorensen at Stack Overflow, Q&amp;A for professional and enthusiast programmers" title="profile for ErikSorensen at Stack Overflow, Q&amp;A for professional and enthusiast programmers">
        </a>
      </div>
    </body>
  </html>

Answer №1

After receiving a nudge from @jascha, the solution became clear.

Adjusted the margin-bottom: 20px; to margin-bottom: 10%; specifically for the jsterm element.

Answer №2

The link provided for GitHub leads to eriksire instead of eriksore. ;)

If you want the scrollbars and the .jsterm div to match the height you have set, consider using this code:

.jsterm {
    overflow-y: scroll;
}

To ensure that the console always appears above the share_box, causing the share box to disappear on smaller screens, you can use the following CSS:

.jsterm {
    z-index: 2;
    position: relative;
}
.share_box {
    z-index: 1;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Input form sending information to an incorrect destination URL

I'm struggling to get my form to pass a parameter to a link in the desired format: index.php?action=2&parameter=value Currently, it is only passing the parameter like this: index.php?parameter=value Here's the code I have been using : &l ...

Loading forms on page load in CodeIgniterWould you like to

Is there a way to include onload javascript in CodeIgniter forms? I want to be able to do something like this within CodeIgniter: form onload="yourscript" Since CodeIgniter uses the form_open() command, I'm unsure how to incorporate the onload scrip ...

Tips for aligning an element with another element's position

Is it possible to have the new hello button displayed in exactly the same position as the previous one after clicking the Hello button? const rightDiv = document.querySelector('#rightDiv'); const leftButton = document.querySe ...

The onSubmit trigger in Google Forms is causing the e.namedValues variable to be

My apps script has a form submit trigger configured as shown below: https://i.sstatic.net/FNgCD.png The function onSubmit looks like this: function onSubmit(e) { console.log("Form submitted", JSON.stringify(e.namedValues)); console.log(" ...

Updating the FormArray index using Angular's `removeAt(i)` function does not reflect changes in the DOM

I initially suspected that there was an issue with my implementation, but it appears that the code I used to create a dynamic FormArray should be working, as indicated in this question I posted. However, when I integrate it into my project, the remove func ...

What is the best way to handle an array received from an ajax call and "parse" it effectively?

Is there a way to update the numbers within 3 spans on my webpage by clicking a button and retrieving an ajax response? The response needs to be valid, which means it should consist of an array with 3 elements. Can you suggest a jQuery solution for this sc ...

Trigger an alert message upon clicking a button within CK Editor

Is it possible to trigger an alert message using ckeditor when a specific button is clicked? Below is the code snippet for reference: $(document).ready(function () { $(".cke_button__bold").click(function () { editor.on("CKEDITOR.cke_butto ...

Updating dropdown values using another dropdown through AJAX in Node.js: A step-by-step guide

My dilemma involves two dropdown menus: one for selecting the main category and another for choosing a subcategory. The goal is to dynamically populate the subcategory based on the main category selection. In my attempts so far, I have utilized JQUERY and ...

Tips for selecting checkboxes with fetched information

I have created a script that passes json data to a variable and then collects all the necessary information such as chapterid, questionid ...etc on the inner html page. jQuery Code: $('div[id^="questionsNo_"]').ready(function() { var assessme ...

Issue with Jquery plugin malfunctioning on dynamically loaded elements via Ajax requests

Description: I'm currently working on a project where I need to load elements with expiration dates pulled from my database. To achieve this, I am using a Jquery plugin that relies on the HTML5 Data Type Attribute for setting the "end date". Everythin ...

Verify whether the elements of an array satisfy a condition only when they are adjacent in a JavaScript program

Consider the following array : [500, 250, 380, 250, 230, 100, 700, 900, 200, 100, 10, 800, 5] My goal is to extract all values less than 350 that are contiguous. Here is the desired result : [[250], [250, 230, 100], [200, 100, 10], [5]] This is what I ha ...

What is the best way to assign a URL to an image source using a JavaScript variable?

I am working on a script that displays different image URLs based on the time of day using an if-else statement. I want to dynamically load these images in an img src tag so that a different picture is loaded for each time of day. I have defined variables ...

Close button located in the upper-right corner is partially cut off

My challenge involves placing a close button on the top right corner of a #main div that contains an image of varying or larger size. I need the close button to slightly protrude outside the div using negative margins. The issue is that when I use overflow ...

What is the best way to incorporate a changing variable within an htmx request?

One of the endpoints in my site requires an ID to be passed as a parameter. For example: mysite.com/product/{id}?limit=5 I'm wondering how to pass the 'id' variable in the hx-get attribute. I can utilize AlpineJS or vanilla JS for this tas ...

Creating an indentation on one side of a div using CSS for a visually appealing effect

https://i.stack.imgur.com/io6m0.jpg I'm in the process of trying to create two shapes using CSS. I've been able to almost achieve the first shape on the left, but it extends out too far. As for the second shape, I'm having difficulties cre ...

I am struggling to understand how to make use of ajax and php to reload data for pagination

$(function(){ $('.page').click(function() { var paging = $(this).attr("name"); var dataString = 'page='+paging; $.ajax({ type: "POST", url: "<?php echo $backtrack; ?>shop.php", data: dataString, ...

What is the best way to add an image element as a child of a list item only when its sibling checkbox is checked, upon clicking another button?

As a beginner in jQuery, I am working on developing a game where users can select and check 3 images from a list of ten. Following this selection, I aim to have the checked images added to a separate unordered list that I have already set up. <ul id="i ...

Implementing Bootstrap modal functionality in PHP

I'm attempting to trigger a hidden modal from an HTML file using PHP as part of a verification process. One modal is displayed when a button is clicked, while the other is meant to be called by PHP. Below is my PHP code: $File = include("index2.html ...

Typescript: Delivering outcomes in a promising way

How do I convert the function below to return a promise for proper handling in the Page where it is called? getUploads() { const rootDef = this.db.database.ref(); const uploadsRef = rootDef.child('userUploads').orderByChild('time&ap ...

Using JavaScript's regular expressions to locate a specific string that may span multiple lines

Is there a way to extract a specific substring from a string using regex even if the substring spans across multiple lines? I attempted to use the multiline flag in my regex pattern like this: "foo\nbar".match(/foobar/m) Unfortunately, this returns ...