Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7891897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:44:03+00:00 2026-06-03T06:44:03+00:00

I have the following script (function(win){ var doc = win.document; if (doc.querySelector && doc.addEventListener)

  • 0

I have the following script

(function(win){
    var doc = win.document;
    if (doc.querySelector && doc.addEventListener) {
        var toggler = doc.querySelector('.toggle-menu')
        var menu = doc.querySelector('.main-nav ul');
        menu.style.height = '0px';
        toggler.addEventListener('click',function(e) {
            e.preventDefault();
            if (menu.style.height == '0px') {
                menu.style.height = 'auto';
                if (menu.clientHeight != 0) {
                    menu.style.height = menu.clientHeight+'px';
                }
            } else {
                menu.style.height = '0px';
            }
        });
    }
})(this);

What will be the jQuery version of that script, since i can’t find a jQuery equivalent to clientHeight.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:44:04+00:00Added an answer on June 3, 2026 at 6:44 am

    clientHeight is not a jQuery property. It was introduced in Internet Explorer, but isn’t part of the W3C specifications. It looks like it is only supported in Firefox and Internet Explorer. I’ve just tested that it works in the latest version of Chrome, though. Not sure if results are standard across browsers, though the link I posted below suggests no.

    Also, Mozilla suggests the following formula to be used in place for browsers that don’t support it:

    clientHeight can be calculated as CSS height + CSS padding – height of
    horizontal scrollbar (if present).

    I’m assuming that is the scrollbar of the element itself, not the entire browser window, unless the element takes up the entire window.

    Sources:

    • clientHeight/clientWidth returning different values on different browsers
    • https://developer.mozilla.org/en/DOM/element.clientHeight
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following: $(document).ready(function() { var myIframe = document.getElementById('myIframe'); var element = myIframe.contentDocument.createElement('script');
I have the following script: <script language=javascript> function process(v){ var value = parseInt(document.getElementById('v').value); value+=v;
I have the following script: Timer=0; function countdown(auctionid){ var auctions; var divs; Timer=Timer+1; if((Timer%10==0)||(Timer==1)){
Hi I have the following script in my form function pdf() { var frm
I have the following jquery function > <script type=text/javascript> > > $(document).ready(function() { >
I have put together the following mootools script window.addEvent('domready', function() { var shouts =
I have the following script: function add_fields(link, association, content) { var new_id = new
I have the following dummy test script: function test() { var x = 0.1
I have the following script: $('#divs').children().each( function(){ //Get Id's var id = $(this).attr('id').replace('id_',''); alert(id);
I have the following script: <script> (function(d, s, id, p) { var js, ins

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.