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

  • SEARCH
  • Home
  • 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 8418703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:24:04+00:00 2026-06-10T02:24:04+00:00

I have a problem i can’t solve by myself and which I coudn’t find

  • 0

I have a problem i can’t solve by myself and which I coudn’t find a solution for.
I wrote a script in jQuery which works with Chrome and Firefox, but it doesn’t work with IE (even the newest one).

At a glance HTML looks like this::

<div id="ContentThatIsAbove"></div>
<div id="someContainer">
      <div id="bonmenu_info_container" style="float: left;">
           <div id="bonmenu_info"></div> 
           <div id="1_info"></div> 
           <div id="2_info"></div> 
           <div id="3_info"></div> 
      </div>
      <div id="bonmenu" style="float: right;">
           <div class="1"></div>
           <div class="2"></div>
           <div class="3"></div>
      </div>

</div>

a jQuery script like this: (‘$j’ is used instead of ‘$’)

<script type="text/javascript">
var $j = jQuery.noConflict();
$j(window).load(function() {
    var MenuOffsetY = $j("#bonmenu").offset().top;
    $j(window).scroll(function(){
        if($j("html").position().top < -MenuOffsetY && $j("html").position().top >-1400 )
        {
            $j("#bonmenu_info_container").css('position', 'fixed');
            $j("#bonmenu_info_container").css('top', '0');  
            $j("#bonmenu_info_container").css('margin-top', '10px');
            $j("#bonmenu_info_container").fadeIn();
        }
        else if($j("html").position().top >= -MenuOffsetY)
        {
            $j("#bonmenu_info_container").css('position', 'relative');
            $j("#bonmenu_info_container").css('top', '');
            $j("#bonmenu_info_container").fadeIn(); 
        }
        else
        {
            $j("#bonmenu_info_container").fadeOut();
        }
    });
    $j("#bonmenu_info_container").children().hide();
    $j("#bonmenu_info").show();

    //This part below works perfectly everywhere.    
    $j("#bonmenu").mouseover(function(){
        $j(this).children().each(function(){
            var infoId = "#"+jQuery(this).attr('class')+"_info";
            $j(this).mouseover(function(){
                $j("#bonmenu_info_container").children().hide();
                $j(infoId).show();              
            });
        }); 
    }).mouseleave(function(){   
        $j("#bonmenu_info_container").children().hide();
        $j("#bonmenu_info").show();
    });
});
</script>

Explanation how it should work:

I don’t want #bonmenu_info_container disappear in the top of a the window while scrolling the page. That’s why in 1st if statemant I check if #bonmenu disappear in the top by checking html’s position.top value. When the statement is true, css position value of #bonmenu_info_container should change from relative to fixed and vice versa.

You can see how it works on Chrome/FF: http://bonappetea.com/menu

What i nocited in Chrome/FF $(‘html’).position().top’s value changes while scrolling and in IE it doesn’t. Do you know why? Or do you have better solution than mine?

I have totally no idea what to do with this code and i don’t want to start it all from zero.

  • 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-10T02:24:05+00:00Added an answer on June 10, 2026 at 2:24 am

    Yes it doesn’t. But body‘s position changes, so you need to check what changed and take an action accordingly.

    var preScrollHtml = document.getElementsByTagName('html').item(0).scrollTop,
        preScrollBody = document.getElementsByTagName('body').item(0).scrollTop;
    
    $j(window).scroll(function(){
       var scrolledHtml = document.getElementsByTagName('html').item(0).scrollTop,
           scrolledBody = document.getElementsByTagName('body').item(0).scrollTop;
    
       var scrolledVal = scrolledHtml != preScrollHtml ? scrolledHtml : scrolledBody;
    
       if(scrolledVal < -MenuOffsetY && scrolledVal >-1400 ) {}
    
       // here all your logic is
    
       // just before end of the handler reset values of these
       preScrollHtml = scrolledHtml;
       preScrollBody = scrolledBody;
    }
    

    and so on

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem which i can't seem to find the solution to. I
I have a problem which can't solve by myself. Here is timestamp 1308085200 taken
I have a problem and can't find a solution. I am making an accordion
I have another problem I can't seem to solve..., or find on this site...
I have a problem and can't solve it alone. My teacher gives me one
i have a problem that i can't solve ! (sqlite3, but i think it
I have a problem here I can't solve. I have a database of houses
I have a problem i can't find the wrong in this function it sometimes
I have a problem and can't find information. I run my web-app from jsp-page
I have a problem I can not solve, when the GPS data logger is

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.