Limit the windows within the scope of a meteor project

My goal is to have circles sliding across the screen, both vertically and horizontally. I want the horizontal tubes to be positioned 'randomly' without the need for scrolling, but at times they exceed the area causing the page to increase in size, requiring scrolling downwards.

Check out my Meteor/Jquery/HTML/CSS code below:


if (Meteor.isClient) {
  Session.setDefault('counter', 0);

  Template.hello.helpers({});

  Template.hello.events({})

  function getColor(){return "rgb("+Math.floor(Math.random() * 256)+","+ Math.floor(Math.random() * 256)+","+  Math.floor(Math.random() * 256)+")"; }
  
  var allVars = -1;
  
  function doIT()
  {
    setInterval(function() {
       allVars++;
       
       var holdName = "Circle"+ allVars;
       var i =holdName;
       
       $div = $("<p>", {id:i, name:"circle"});
       
       if(allVars%2!=0){  
         var number =  Math.floor(Math.random() * ($( "#HOLD" ).width()));
         
         $div.css({top: -100, position:'absolute',"background-color":getColor(),width:(10+ Math.floor(Math.random() * 100)});
         
         $div.animate({'marginLeft':number});
         $("#HOLD").append($div);
         var a = $( window ).height()+100;
         $("#"+i).animate({height: a},5000);
       }
       else{
         $div.css({left: -150, position:'absolute',"background-color":getColor(),height:(10+ Math.floor(Math.random() * 100)});
         var n = $("#HOLD").css('width').indexOf("p");
         var it = $("#HOLD").css('width').substring(0,n);
         var number = Math.floor(Math.random() * (parseInt(it)));
         $("#HOLD").append($div);
         $("p").text(number);
    
         $div.animate({'top':number});
         var a = $( "#HOLD" ).width()+200;
         $("#"+i).animate({width: a},6000);
       }
     }, 4000);
}

Meteor.startup(function () { 
  $("#HOLD").css({width:'100vw', height:'100vh'});
  alert($("#HOLD").css('width'));
  doIT();});
}
if (Meteor.isServer) {

}
[name="circle"] {
    width: 50px;
    height: 50px;
    -webkit-border-radius: 25px;
    -moz-border-radius: 25px;
    border-radius: 25px; 
    color: red;
    text-align: center;
}
body
{
   background-color: blue;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<head>
  <title>Circles</title>
</head>

<body>
  {{> hello}}
</body>

<template name="hello">
<div id="HOLD">
<p> _ </p>
 <iframe width="0" height="315" src="https://www.youtube.com/embed/B4qdpiad_Q0?&autoplay=1&loop=1&playlist=B4qdpiad_Q0" frameborder="0" allowfullscreen></iframe>
</div>

</template>

Answer №1

Exploring container dimensions and overflow

height:100vh;
width:100vw;
overflow:auto;

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

The AngularJS routing template fails to load

I am currently working on the app.js file: 'use strict'; var app = angular.module('app', [ 'auth0', 'angular-storage', 'angular-jwt', 'ui.router', 'Environment', ...

click event on ion card

Attempting to handle a click event within an ion-card using Ionic 5.0.2 version has presented some challenges. Despite my efforts, I have not been successful in handling the event with the expected function. Here is a snippet of my code: Dynamic card list ...

I'm encountering a Parse error: syntax error, wherein the file unexpectedly reaches its end

I'm currently in the process of creating a personalized search engine that enables users to search using multiple fields. However, an error message stating "syntax error, unexpected end of file" keeps popping up, specifically on line 201 of my code, r ...

The function is not recognized in C# programming language

Whenever I try to trigger functions by clicking buttons, nothing seems to happen and an error message appears in the console. Uncaught ReferenceError: AddressInputSet is not defined at HTMLButtonElement.onclick I'm new to this and could use ...

Are there any external tools available for image editing in asp.net?

Looking to incorporate an image editor on my website, but having trouble finding a solution. If there are any third-party plugins available, please share them with me. Thank you in advance! ...

Upon being provided with a route param, the response will be

For my current project using Express, I want to implement Reddit-like functionality where appending ".json" to any URL will return JSON data instead of the rendered template. To set up the rendering engine in Express, I am using Jade. Here is how I config ...

bing translator API: the variable text is translated with no content

I'm encountering an issue while working with javascript and PHP. The PHP code seems to run fine until it reaches the $curlResponse variable. From there onwards, all the subsequent variables ($xmlObj, $translatedStr, $translatedText) appear to be empty ...

steps to retrieve menu and its corresponding subcategories from a database

This is my custom menu <ul class="menu-items"> <li><a href="product-category.html">Category 1</a></li> <li><a href="product-category.html">Category 2</a> ...

There was an issue with rendering: "TypeError: Unable to access the 'name' property of an undefined object" [Vue alert]

I encountered the following error message: TypeError: Cannot read property 'name' of undefined Here's the snippet from the Vue file where the error occurred: <tr v-for="user in fields.data" :key="user.id"> <td>{{ user.id ...

Client-Specific User Portal

Looking for some support on the back end of things. We are in the process of creating a portal where users will be directed to their specific landing pages upon logging in, providing access to files they have signed up for. Our team is exploring the use ...

I am currently experiencing difficulties with uploading an image from the admin panel in Magento 1.9. Instead of receiving the expected response, I am

I encountered an error while trying to upload a file in Magento for a product image. When I click on upload, an error is displayed during the file upload process. Upon further investigation in the product.js file for item response, I noticed that HTML is b ...

What is the best way to create a hover delay in jQuery?

I am trying to make a slider with thumbnails underneath the slides. I would like to hover over a thumbnail image and have the slide change to match the thumbnail after a one-second delay. Is there a way to achieve this? $(function(){ $("#main ...

What is the best way to convert minutes into both hours and seconds using javascript?

In order to achieve this functionality, I am trying to implement a pop-up text box where the user can choose either h for hours or s for seconds. Once they make their selection, another pop-up will display the answer. However, I am facing issues with gett ...

Is it possible to use jQuery and .load() to dynamically refresh multiple div elements with different unique IDs?

Currently, I am in the process of customizing a plugin to enable users to vote on posts. The layout of my page resembles this structure (albeit simplified): <div class="vote vote1"> //voting buttons </div> <div class="vote vote2"> //vot ...

Delivering data via Ajax to MVC 4 Controller

Attempting to use Ajax for a simple pass. Both artID and v variables are correctly populated, but consistently encountering an Ajax error. Controller: Article Method: SaveRating Ajax script: $.ajax({ type: "POST", ...

When it comes to TypeScript, there is a limitation in assigning a value to an object key with type narrowing through the

I created a function called `hasOwnProperty` with type narrowing: function hasOwnProperty< Obj extends Record<string, any>, Prop extends PropertyKey, >( obj: Obj, prop: Prop, ): obj is Obj & Record<Prop, any> { return Object ...

Enhance your FullCalendar experience with React by displaying extra information on your calendar

I am new to using React and FullCalendar, and I have a page layout similar to the image linked below. https://i.sstatic.net/MooTR.png Additionally, I have a list of events structured as shown: id: "9", eventId: "1", ...

What could be causing the unusual alignment of the 'pixels' on my resized HTML5 canvas?

Currently, I am in the process of creating a simple HTML5 canvas/JavaScript snake game inspired by the classic Nokia Snake. This is my first attempt at developing a game using HTML5 canvas and JavaScript, and I must admit, I am still a novice programmer! ...

Percentage-based framework for CSS grid system

Exploring the world of CSS grids has been a fascinating learning journey for me. After delving into my research and consulting resources like: http://css-tricks.com/dont-overthink-it-grids/ I've noticed that percentage-based grids generally make the ...

The List<type> parameter within an ASP MVC controller action is coming back as null instead of an empty list

When using ASP MVC 3 with jQuery.ajax to post array values with traditional:true, everything works perfectly fine as long as the array contains values. However, I encounter an issue when the array is empty in the JavaScript – the value passed into the re ...