0

I've got a problem which you can look at here http://jsfiddle.net/dng2P/4/

If you click the detail button it shows you information and then if you click the "Points Statement" button it slides a layer down.

My problem is that I'm trying to make the main booking details div the same height as the points div if it's bigger and then when you click close put the main booking details height back to what it was originally.

It's half working as the main booking details div becomes the same height as the points div but just doesn't go back to what it was originally

Can anyone help?

Thanks

Jamie

2 Answers 2

2

How's this? http://jsfiddle.net/dng2P/8/

All you did wrong was failing to keep the original height around properly. You only declared bookingdetailheight as a local variable which means it got re-declared for every toggle, and removed after every toggle was complete. I tied the original height to the DOM element with using .data(), it simplifies things when you might have people opening two of those toggles simultaneously.

I got on a roll though, so tidied up a bit and made the outer animate along with the inner. Oh and please look up the proper traversal methods in jQuery, parent().parent().parent().find() is asking for trouble. I think there's some left in parts I didn't look at.

2
  • Thank that works brilliantly appreciate the help and patience Oct 7, 2010 at 14:13
  • jamie, glad you got a working solution... i 'knew' the bookingdetailHeight variable was causing the issue. nice to see alexander taking it 'home'... +1 nice one
    – jim tollan
    Oct 7, 2010 at 18:19
0

I had a quick look at the jsfiddle code. I think the value that you take into the bookingdetailHeight should be declared outside the scope of the .points toggle function. that may help a little. just gonna try that :)

[edit] - didn't solve it -sorry :(

3
  • I've change the first link to another one which i'm currently working with and it has two properties Oct 7, 2010 at 11:31
  • ok, will take a look at that and report anything back that i find.
    – jim tollan
    Oct 7, 2010 at 11:38
  • jamie, i didn't fully get to the bottom of it - however, i've got a feeling that the parent() hierarchy could be an issue potentially. i think there's a way to use parents() to navigate around deep tree structures. might be best to attack that avenue 1st. sorry to have added nothing to the party here :(
    – jim tollan
    Oct 7, 2010 at 11:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.