Using Java Script to adjust dimensions in a webpage

As a newcomer to JS, I encountered my first simple problem that I can't seem to solve.

Currently working on a basic website using an online editor, I decided to add a shoutbox from shoutbox.com

In order to use the shoutbox, I embedded it in an HTML box, which worked fine. However, I ran into an issue where a horizontal scrollbar appeared within the HTML box. No matter what I tried with HTML body codes, the scrollbar persisted. Increasing the size of the HTML box only stretched the shoutbox without removing the scrollbar.

The shoutbox's width is set to 100% and the height to 360px. The shoutbox.com FAQ provides instructions to adjust both properties, but it's not clear how to apply them:

<script src="https://www.shoutbox.com/chat/chat.js.php"></script><script> var chat = new Chat(112308);  </script>

The FAQ advises:

To change the width: embed the chat into a div element with the desired width.

To change the height: override the .shoutBoxContainer CSS.

An example is provided as well:

var chat = new Chat(5, "John"); <style> .shoutBoxContainer {height:450px;} </style> 

I wanted to try setting the shoutbox to a width of 90% to see if this resolves the issue.

My question: How can I achieve this?

Answer №1

When incorporating a CSS file into your webpage, simply add the code snippet at the bottom of the file:

.shoutBoxContainer {
   height:450px;
   width:90%;
}

If you don't have a separate CSS file, you can include the styles in a <style> tag within the <head> section of your HTML. Your code will then appear like this:

<head>
<script src="https://www.shoutbox.com/chat/chat.js.php"></script>
<style> 
   .shoutBoxContainer {
      height:450px;
      width:90%;
   }
</style>
</head>
<body>
   <script> var chat = new Chat(112308);  </script>
</body>

Be sure to ensure that your CSS is loaded after the chat.js.php file for proper styling.

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

What could be causing my node server's REST endpoints to not function properly?

Here is a snippet of my index.js file: var http = require('http'); var express = require('express'); var path = require('path'); var bodyParser = require('body-parser') var app = express(); var currentVideo = &apos ...

The completion event for Ajax and Json does not activate Google Maps

I'm currently facing an issue with my Google Maps functionality. Despite trying various solutions that involve hidden tabs, the problem persists. The trouble lies in the fact that my ajax function successfully posts and retrieves data, but fails to tr ...

Ways to resolve a blank outcome in the $scope selection choices list?

Currently, I am utilizing AngularJS to create a select dropdown field populated with options from an array. The end user has the ability to add options via an input box. While the $scope successfully adds to the array, the dropdown select box displays "und ...

Securing API access by limiting it to verified domains with Express.js

I am currently enhancing the security of my Node.js/Express.js application by implementing restrictions on access to an authlist (authorized list) of domains. Note: The opposite of an authlist is a denylist. Overview: Users are able to create a Proje ...

CORS policy is preventing preflight requests to Cloud functions using the OPTIONS method

Currently, I am working on a project to develop a basic app where users can upload a .pdf file on the front end. The server will receive the file and process it until it generates a Firebase storage link. The front end is hosted on Firebase Hosting, while ...

How can a single value (the clicked one) be retrieved from a for loop using addEventListener in a Django project with JavaScript

Struggling to integrate JS into my Django project, I received the following message in the console: HTMLCollection(2) [p.currency-one, p.currency-one] HTMLCollection(2) [input.amount-one, input.amount-one] app.js:21 Uncaught TypeError: c1.addEventListener ...

JavaScript comparing variables to nested object properties

items resembling this are heading my direction: var info = { a0: { name: 'lengthy title 0', var1_min: '10', var1_max: '99', select: ['alpha', 'gamma'], display: 'value0' }, b12: { ...

Tips for preventing redirection in Vue 3 composition API with asynchronous requests

I have successfully configured a submission form to send data to my email and add it to a Google sheet using the method described in this GitHub link. The process worked seamlessly for both purposes. However, I am facing an issue where upon submitting the ...

Display various components using a dropdown selection

I am seeking guidance on how to display different components based on the selected option. I am unsure of how to write the code for displaying either component one or two. Can you provide any examples or references that may help? <template> <div ...

What is the best way to attach 'this' to an object using an arrow function?

Consider having an object named profile which consists of properties name and a method called getName (implemented as an arrow function). profile = { name: 'abcd', getName: () => { console.log(this.name); } } I am interes ...

Distinct "namespaces" within HTML

Recently, I've encountered an issue with my application that is causing ID collisions. The application uses AJAX to dynamically load code snippets based on user demand. Although these snippets vary significantly, there are instances where a code snipp ...

Issue encountered while deploying on vercel: TypeError - Trying to access properties of undefined (specifically 'and')

Encountered this issue during deployment on Vercel. Npm run build did not show any errors. Configuration : "node": "18", "next": "^14.0.0", "next-transpile-modules": "^9.1.0", An error occurred d ...

Using JavaScript within SQL allows developers to combine the power

Every year, I need to insert a new primary key into my SQL database that follows a specific format (for example, in 2012 the key is 2012000000, and in 2013 the key is 2013000000). I want this process to happen automatically. My plan is to incorporate a sc ...

The statusMessage variable is not defined within the "res" object in a Node Express application

I am currently developing a Node.js & Express.js application and I am in need of creating a route to display the app's status. router.get('/status', function(req, res) { res.send("Current status: " + res.statusCode + " : " + res.stat ...

Creating a real-time text field update feature for a form using Google Script

One of my clients is dealing with a large number of contacts and to streamline the process, I created a form with a scrolling list for contact selection. However, the list has become too long to navigate easily. Is there a solution that would allow the c ...

Trying to extract data from the ASX website's table using web scraping techniques

My goal is to extract the current stock value from the ASX.com.au website. Specifically, I am interested in retrieving the current ASX value, which can be located here. The value I am looking for is in the second td from the left, currently standing at 30 ...

Steps to deactivate the select element in backbone.js

Can someone help me with disabling the select option in my MVC template code using backbone.js? I tried using readonly="readonly" and disable="disable", but it sends null as value and doesn't update my address. <div class="login-register" data-val ...

Having trouble with my bootstrap slider carousel - it's just not cooperating

I incorporated Bootstrap's carousel to display the various courses on my website, featuring three courses at a time before transitioning to the next set of three. However, I am encountering an issue with this setup. Please see the image below for refe ...

Lambda function failing to execute Auth0 methods through the Auth0 node-auth0 SDK

I am working with a lambda function that triggers when a message is added to the SQS queue. Within the message, there is a userId that I want to connect to using the Auth0 node SDK. The code snippet for my GetUserDetails function below shows that it logs ...

Performing asynchronous ajax calls with jQuery

Here is some code I have that involves a list and making an ajax call for each element in the list: util.testMethod = function(list) { var map = new Map(); list.forEach(function(data) { $.ajax({ ...