Go Back   MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Reply
 
Thread Tools Search this Thread Display Modes
Old Mar 3, 2011, 02:12 PM   #1
dkotter
macrumors member
 
Join Date: Jul 2009
JavaScript Question

I am not an expert at all with JS, but I created a page that has headings, and then when you click on the heading, a hidden div will appear. I was having problems with it filling the page correctly and with the image next to the heading changing from a side arrow to a down arrow, but I figured all of that out.

My problem I'm having now is when you click on one of the headings and it expands the content, it takes you back to the top of the page. This can all be viewed at starmoose.com/jobs.html.

It doesn't matter if you're selecting one of the top jobs, but if you scroll down and select one of the bottom jobs, it jumps you back to the top of the page, forcing you to scroll back down to read the job description. I know there is a way to not make it jump, but not sure if it's in the JavaScript or what. Code can be seen below.

Code:
$(document).ready(function initJobPostings(){
		  $('.job_posting h2').click(function(e){
			  var $_pn=$(this.parentNode);
			  if($_pn.is('.job_posting_expanded')){
				  $_pn.removeClass('job_posting_expanded');
				  $_pn.find('.details').slideUp();
				  }
		      else{
				  $_pn.addClass('job_posting_expanded');
				  $_pn.find('.details').slideDown();
			  }
		  });
      });
dkotter is offline   0 Reply With Quote
Old Mar 3, 2011, 03:34 PM   #2
dkotter
Thread Starter
macrumors member
 
Join Date: Jul 2009
Never mind, I fixed the issue.
dkotter is offline   0 Reply With Quote

Reply
MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Tags
javascript

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Javascript Problem?? sk000 Mac Basics and Help 4 Apr 5, 2014 08:06 AM
How to run a javascript dinggus Web Design and Development 6 Feb 12, 2013 11:15 PM
JavaScript keeps enabling itself nilesisniles iOS 6 1 Nov 27, 2012 05:40 PM
Flash/Javascript Question nightlong Mac Applications and Mac App Store 2 Aug 27, 2012 09:46 PM

Forum Jump

All times are GMT -5. The time now is 09:50 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC