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 7646443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:12:37+00:00 2026-05-31T10:12:37+00:00

I have this jquery function: $(window).scroll(function () { if ($(window).scrollTop() > offset.top) { $(#sidebar).css(marginTop,

  • 0

I have this jquery function:

$(window).scroll(function () {
            if ($(window).scrollTop() > offset.top) {
                $("#sidebar").css("marginTop", $(window).scrollTop.length - offset.top);
                $("#sidebar").css({ opacity: 0.2 });

                $("#sidebar").mouseenter(function () {
                    $("#sidebar").css({ opacity: 1 })
                });
                $("#sidebar").mouseleave(function () {
                    $("#sidebar").css({ opacity: 0.2 })
                });
            } else {
                $("#sidebar").css("marginTop", "0");
                $("#sidebar").css({ opacity: 1 })
                $("#sidebar").mouseleave(function () {
                    $("#sidebar").css({ opacity: 1 })
                });
            };
        });

second function:

$(document).ready(function () {
        $('#account-trigger').click(function () {
            $(this).next('#login-content').slideToggle();
            $(this).toggleClass('active'); 
            if ($(this).hasClass('active'))
              $(this).find('span').html('▲')
            else 
              $(this).find('span').html('▼')
        })
        $('#cart-trigger').click(function () {
            $(this).next('#cart-content').slideToggle();
            $(this).toggleClass('active'); if ($(this).hasClass('active')) $(this).find('span').html('▲')
            else $(this).find('span').html('▼')
        });
 });

In the first function, i am trying to keep my #sidebar afloat at scroll,in the second function there is #sidebar which contains the menu that has the #account-trigger & #cart-trigger. #account-trigger & #cart-trigger opens up their sub menu respectively, on click.

The problem is when I click on the #account-trigger or #cart-trigger my window scroll automatically goes to top. There is no problem when the scroll is at top, indicating that the first function is working fine.

How it should work is when i scroll the content the sidebar should come to the top and the opacity should decrease but on hover the sidebar opacity should reset to 1 and when clicked on the menu inside the sidebar, it should open menu there itself.

The answer is: instead of putting # in href, when i put
javascript:void(0); it worked. thanx @mandeep it was pending from a
long time.

  • 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-05-31T10:12:38+00:00Added an answer on May 31, 2026 at 10:12 am

    Instead of putting # in href, when i put javascript:void(0); it worked. thanx @mandeep it was pending from a long time.

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

Sidebar

Related Questions

http://designobvio.us/DoUs/directPro.html jQuery Script $(window).scroll(function() { $('#nav').css('top', $(this).scrollTop() + px); }); HTML <nav id=nav class=grid_2>
I have this at the top of my jQuery script: $().ajaxStart(function() { alert('ok'); });
I have a jquery function that changes an image depending on scroll position. This
I have this jQuery: $(document).ready(function() { $(#panel).hide(); $('.login').toggle( function() { $('#panel').animate({ height: 150, padding:20px
I have this jQuery which works fine $(li[id^='shop_id']).click( function () { alert(I clicked on
I have this simple function: <script type=text/javascript> //<![CDATA[ jQuery(function($){ function here(b){alert(b);} ; here(6); });
I have the following jquery code: jQuery(function(){ jQuery(select#rooms).change(function(){ var options = ''; jQuery.getJSON(/admin/selection.php,{id: jQuery(this).val(),
I have this code in jquery : $(#order_btn).click(function(){ var totalprice = $(.price_amount).text(); $(#totalprice).val(totalprice); });
I have this code in jQuery.. $(document).ready(function(){ var fieldCounter = 0; ... I have
We have this anonymous function in our code, which is part of the jQuery's

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.