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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:07:11+00:00 2026-05-28T03:07:11+00:00

I have a block following my menu buttons, to indicate which one is active.

  • 0

I have a block following my menu buttons, to indicate which one is active. Is there a way to keep the block’s location after a refresh?
As of now the location gets reseted when I press a link in a subpage.

jquery code:

$( "button",document.body ).click(function(){
    var offset = $(this).offset();
    var offsetBody = $("body").offset();
  $( "#block" )
     .animate({
    left: (offset.left - offsetBody.left) 
  }, 200);
});
  • 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-28T03:07:12+00:00Added an answer on May 28, 2026 at 3:07 am

    Jquery is a client-side script. When you reload a page or navigate to a new page you request the information from the server, meaning that all client-side data is lost.

    There would however, depending on you precise problem, be a number of solutions.

    1. If you are only interested in the location of the block on each page individually then you could code some element in the mark-up to have an attribute value equal to something, check this value upon loading if the DOM and move the block accordingly.

    2. You could use client-side cookies to store a value and upon loading of the DOM check this variable and animate the block accordingly.

    3. You could use an AJAX call to set a server-side variable in PHP and use this variable to dynamically create the element in 1.

    Would any of these three solutions work do you think? I can go in to more detail if you can tell me more precisely how you would like to accomplish this.

    For method 1.

    Use the JQuery .attr() method such that;

    Markup

    <meta name="description" content="home" />
    

    JQuery

    var page = $('meta[name=description]').attr("content");
    if (page == "home") {
        // you know where it should be
    } else if (page == "account") {
        // you know where it should be
    }
    

    However I’m a little concerned this isn’t exactly the functionality you want, is it?

    For method 3

    Markup

    <?php
        session_start();
        $pos = $_SESSION['position'];
        echo '<meta name="description" content="' . $pos . '" />'
    ?>
    

    JQuery

    var position;
    // perform animation stuff and store position in the variable
    // make a post() request after the position has changed
    $.post("position.php", { pos: position } );
    

    PHP position.php

    <?php
        session_start();
        $_SESSION['position'] = $_POST['pos'];
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following Code Block Which I tried to optimize in the Optimized section
I have a menu in which only one item has a sublist. Here is
I have added a menu item in edit control block(ECB) in document library(using following
i have the following code ,which draws mandelbrot set.I created a menu with an
I have the following drop down menu and the background looks black in Chrome
i have the following block of code: $(#contact_container form, #contact_details form).live( submit, function(event) {
given i have the following block of code (function(){ var mb = { abc:function(){
I have the following code block in my xslt; <xsl:when test=StatusData/Status/Temperature > 27> <td
I need syntax help with the following code logic: I have a code block
Please help regarding the following issue. I have enabled the Block popup option in

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.