View Full Version : Need help editing "bios.js" (expanding/collapsing <li>'s)

03-08-2012, 03:28 PM
Hello everyone!

I'm newly managing a small college website with next to no experience.

There is a file called "bios.js" which creates expanding/collapsing li's. The problem is that I've put some hyperlinks into the expanded content, and it seems that "bios.js" is in front of, so clicking the hyperlink simply collapses the list item instead of opening the link.

Is there any way to:
a) have the hyperlinks trump the javascript?
b) Make "bios.js" apply to the title class of the list item rather than the list item itself?

I'm new to this, so I'm not going to post 100 lines of code before I know if it's doable. And if you reply to this, perhaps you could give me a hint as to what part of the code I should post (the open-hover portion?). Thanks all!

03-08-2012, 04:34 PM
First of all a link to the site is a good help and you can attache the js file (bios.js) so we can look at it.

03-08-2012, 04:46 PM
Ok, I've attached the file as a css, and here's the link: http://dev.www.brynathyn.edu/admissions/newstudents

You'll need a username/password, which I'm not going to post here. email me at dylan.odhner@brynathyn.edu and I'll send username and password.

Thanks to anyone who is looking at this! -Dylan

03-08-2012, 04:47 PM
You can send me a temporary username/pwd in the PM (private messaging)

03-08-2012, 05:58 PM
The reason of the problem is that an event is attached to the li and that changes the css class when clicking. If it is open then it closes and vice versa.

Since the anchor element is inside the li it will inherit the onclick event from its parent.

What I did was to stop the propagation when clicking only on the anchors.

I have added the following code in the file bios.js

$("a").each(function (i) {


I have tested it on firefox and on IE8 and seems to be working, however it is up to you to decide if this is the way you want it to work or not.

Let me know what happens.

03-08-2012, 06:04 PM
Silly question Ckeyrouz:

Where exactly did you put that code in bios.js? Does it matter?

03-08-2012, 06:05 PM
It doesn't matter as long as it is inside the main function

$(document).ready(function() {

03-08-2012, 06:11 PM
Solved! Thank you Ckeyrouz!

Simple and effective solution.

03-08-2012, 06:24 PM
Most welcome. Glad I was able to help.