Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Reply
 
Thread Tools Search this Thread Display Modes
Old Mar 3, 2011, 01: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, 02: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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Javascript question prechrchet Web Design and Development 0 Feb 9, 2006 08:30 PM
Small JavaScript Question simX General Mac Discussion 2 Aug 13, 2003 04:31 PM
More JavaScript Questions comrade Community 6 May 22, 2003 09:08 PM
Javascript question Beej Mac Help/Tips 8 Sep 24, 2002 10:39 PM
JavaScript Question... simX Mac Help/Tips 1 Aug 14, 2002 04:00 PM


All times are GMT -5. The time now is 07:21 PM.

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

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