Stopping disabled elements from changing page size?

css resize handle
css window resize
resize div based on window size css
resizable div bootstrap
auto resize div to fit content
textarea resize vertical only
textarea resize off
resize icon css

I have a search bar with a toggle button above it. When I click the toggle button, it gradually changes the opacity. It works great, but it looks a bit clunky, because when I disable it (thus hiding the element), it changes the size of my page. Is there an alternative way of disabling and hiding the element?

Javascript:

function ToggleSearchBar() {
  var searchbar = document.getElementById("SearchBar");
  var display = getComputedStyle(searchbar).display;
  if (display == "none") {
    searchbar.style.opacity = 0;
    searchbar.style.display = "block";
    var i = 1;

    function IncreaseOpacity() {
      setTimeout(function() {
        searchbar.style.opacity = i * .1;
        i++;
        if (i <= 10) {
          IncreaseOpacity();
        }
      }, 30)
    }
    IncreaseOpacity();
  } else {
    var v = 10;

    function DecreaseOpacity() {
      setTimeout(function() {
        searchbar.style.opacity = v * .1;
        v--;
        if (v >= 0) {
          DecreaseOpacity();
        } else {
          searchbar.style.display = "none";
        }
      }, 30)
    }
    DecreaseOpacity();
  }
}

I changed your display = "none" to visibility = "hidden". This should do the trick.

function ToggleSearchBar() {
  var searchbar = document.getElementById("SearchBar");
  var display = getComputedStyle(searchbar).display;
  if (display == "none") {
    searchbar.style.opacity = 0;
    searchbar.style.display = "block";
    var i = 1;

    function IncreaseOpacity() {
      setTimeout(function() {
        searchbar.style.opacity = i * .1;
        i++;
        if (i <= 10) {
          IncreaseOpacity();
        }
      }, 30)
    }
    IncreaseOpacity();
  } else {
    var v = 10;

    function DecreaseOpacity() {
      setTimeout(function() {
        searchbar.style.opacity = v * .1;
        v--;
        if (v >= 0) {
          DecreaseOpacity();
        } else {
          searchbar.style.visibility = "hidden";
        }
      }, 30)
    }
    DecreaseOpacity();
  }
}
<div class="search-button">
  <p onclick="ToggleSearchBar()">Search</p>
  <form id="SearchBar">
    <input type="text" placeholder="        Your query here">
  </form>
</div>

How to Stop page elements resizing? [#1911076], clean pages, and they have managed to disable the mobile version. How do you do this? I just want the page to keep its dimensions, instead of trying to resize itself If i change the width to a precentage, i get small gaps in between the but they have managed to stop any page elements resizing as the� I am happy with how my webpage looks on a normal sized screen, but when i load it up on my ipad, or iphone, the side bars get squeezed, the content stretches and doesnt look right. And where i have tables with images in the main content, the side bars just move over the top and hide half of the main content. I have seen other peoples corporate clean pages, and they have managed to disable the

I don't know how your css style it ! But to prevent page from resizing you can set fixed property for your parent element . As a example , I give fixed height to parent .search-button class , you can do your own by refrencing it

function ToggleSearchBar() {
            var searchbar = document.getElementById("SearchBar");
            var display = getComputedStyle(searchbar).display;
            if (display == "none") {
                searchbar.style.opacity = 0;
                searchbar.style.display = "block";
                var i = 1;
                function IncreaseOpacity() {
                    setTimeout(function(){
                        searchbar.style.opacity = i * .1;
                        i++;
                        if (i <= 10) {
                            IncreaseOpacity();
                        }
                    }, 30) 
                }
                IncreaseOpacity();
            } else {
                var v = 10;
                function DecreaseOpacity() {
                    setTimeout(function(){
                        searchbar.style.opacity = v * .1;
                        v--;
                        if (v >= 0) {
                            DecreaseOpacity();
                        } else {
                            searchbar.style.display = "none";
                        }
                    }, 30)
                }
                DecreaseOpacity();
            }
        }
.search-button {
background :#eee;
padding:10px;
height:100px;
}
<div class = "search-button">
        <p onclick = "ToggleSearchBar()">Search</p>
        <form id = "SearchBar">
            <input type = "text" placeholder = "        Your query here">
        </form>
    </div>

How to Disable the Resizing of the <textarea> Element?, As we know, WebKit has a privilege over other browsers in page control and CSS features. To prevent a text field from being resized, you can use the CSS resize Or you can provide your <textarea> size just by setting the cols and rows� I'd rather use static widths and if you'd like your page to resize depending on screen size, you can have a look at media queries. Or, you can set a min-width on elements like header, navigation, content etc.

resize, The resize property controls if and how an element can be resized by It's also worth knowing that Firefox will let you resize an element smaller than its original size. The handle appears on the right on page elements when the page's Then the user should be able to change the width between the min� Sometimes web pages have small text or are hard to read. Today on 2-Minute Miracles, we'll show you how to zoom in and out on a Web page. Most Web browsers give you the ability to zoom in on a page, making it bigger. Let's take a look at some easy keyboard steps for browser zoom. PC: Press the CTRL key and the + or -key to zoom in or out

Fixed issues in InDesign, [macOS only] InDesign crashes when you try to quit the application in some cases. InDesign crashes on using Adjust Layout, if the document has an InDesign randomly crashes on re-sizing a text frame with auto-size applied. Option to mark fonts as favorite disappears if font preview is disabled. I hit something and the page is too large for my screen. This thread is locked. You can follow the question or vote as helpful, but you cannot reply to this thread.

[PDF] HP LaserJet Pro M404-M405 User Guide - ENWW, Use the HP Embedded Web Server (EWS) to disable the Cartridge Policy feature . NOTE: To prevent jams, adjust the paper guides to the correct size and do not from the output bin and place it with the printed-side facing down in the input. In the Internet browser beginning page, select in the top-right corner "Settings". Roll down and select " Screen Size. You can tap the left and right arrows or slide the bar left and right to edit

Making Content Usable for People with Cognitive and Learning , Please find the change log for those changes in this Working Draft. Avoid memory barriers that stop people with cognitive disabilities from using content. what all controls and elements are on each page and how to use them. may be difficult to understand or perceive due to minimal type size or type� The text-size-adjust property allows web authors to disable or modify this behavior, as web pages designed with small screens in mind do not need it. Syntax. The text-size-adjust property is specified as none, auto, or a <percentage>. Values none Disables the browser's inflation algorithm. auto Enables the browser's inflation algorithm.

Comments
  • Which element do you want to disable?
  • The form element. You can see the changes being made to it in the js code.
  • Yeah that worked just fine after I changed the rest of the respective properties. Thanks a lot!
  • Was working on my code based on your suggestion when holydragon posted. Same idea though. Thanks a lot man