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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:16:38+00:00 2026-06-13T13:16:38+00:00

I am trying to run both a jQuery and Javascript code using one link.

  • 0

I am trying to run both a jQuery and Javascript code using one link. Basically the navigation bar will start in the middle of the screen, then once a menu has been clicked, the nav bar and logo will animate to top and content of that page will appear. Can anyone help me?

Can I just also say i am only a beginner so my knowledge is very bad! Any help would be appreciated!

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
       <title>****</title>
    <link href="design/style.css" rel="stylesheet" type="text/css"/>
    <script type="text/jquery" src="design/scripts/jquery.js"> </script>
    <script type="text/javascript" src="design/scripts/homes.js"> </script>
        <script>
        $(document).ready(function(){
        $(".topPage").click(function(){
        $("#headingBlock").animate({marginTop:"=0px"});
         });
         $("#midPage").click(function(){
     $("#headingBlock").animate({marginTop:"=150px"});
     });
    });
    </script>

</head>
<body>
    <div id="headingBlock">
    <div id="logo">
    <a href="index.html"> <img src="design/images/pmb_logo.png" alt="****"/>
    </a>
    </div>
    </div>

<div id="navStrip">
    <div id="navBlock">
    <div id="nav">
        <a href="index.html" id="midPage">Home</a>
        <a href="#" class="topPage" onclick="switchMain1()">Our Homes</a>
        <a href="#" class="topPage" onclick="switchMain2()">Displays</a>
        <a href="#" class="topPage" onclick="switchMain3()">Where we build</a>
        <a href="#" class="topPage" onclick="switchMain4()">Why PMB?</a>
        <a href="#" class="topPage" onclick="switchMain5()">Style</a>
        <a href="#" class="topPage" onclick="switchMain6()">Contact Us</a>
     </div>
    </div>
</div>

<div id="mainContainerHomes" style="visibility:hidden">

<div class="mainContent" > 

<p> Lorem Ipsum is simply dummy text of the printing and typesetting industry.<br> 
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, <br>
when an unknown printer took a galley of type and scrambled it to make a type <br>
specimen book. It has survived not only five centuries, but also the leap into <br>
electronic typesetting, remaining essentially unchanged. It was popularised in the <br>
1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more <br>
recently with desktop publishing software like Aldus PageMaker including versions of <br>
Lorem Ipsum. </p>

</div>

</div>


<div id="mainContainerDesign" style="visibility:hidden">

<div class="mainContent" > 

<p> Lorem Ipsum is simply dummy text of the printing and typesetting industry.<br> 
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, <br>
when an unknown printer took a galley of type and scrambled it to make a type <br>
specimen book. It has survived not only five centuries, but also the leap into <br>
electronic typesetting, remaining essentially unchanged. It was popularised in the <br>
1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more <br>
recently with desktop publishing software like Aldus PageMaker including versions of <br>
Lorem Ipsum. </p>

</div>

</div>

<div id="footer">

<h1> Designed by *** </a> </h1>

</div>

</body>

  • 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-13T13:16:39+00:00Added an answer on June 13, 2026 at 1:16 pm

    One option is to remove your onclick="..." and try this:

    jQuery(document).ready(function($){
        $(".topPage").click(function(){
            $("#headingBlock").animate({marginTop:"0px"});
            switchMain($(this).index());
            return false; // stop propagation and page jump
        });
        $("#midPage").click(function(){
             $("#headingBlock").animate({marginTop:"150px"});
        });
    });
    

    then create a single switchMain that does what each 1-6 does based on the passed in index (which will be 0-6 in the given example)

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

Sidebar

Related Questions

I am trying to run code on several cores (I tried both the snow
I am trying to add a jquery colorbox to my webpage using the code
I am trying to run two different jQuery/Java Scripts under one file name... And
Is it possible to run both session and cookie helpers? Cause I am trying
Situation: I'm trying run an https store (xcart) under one domain secure.example.com and I
I am trying to run the following code but confused with what's happening here:
I am trying to run a program compiled from C code from an unknown
I find myself using jQuery objects with regular js objects often; I'm trying to
I'm trying to create a link as follows in HTML: <a href=javascript:void(0) onclick=print(string)> I'm
I'm trying hand in developing my first jQuery plugin and I've run into many

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.