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>
One option is to remove your
onclick="..."and try this:then create a single
switchMainthat does what each 1-6 does based on the passed in index (which will be 0-6 in the given example)