Jump to content

jQuery Resize strange activity


onlyican

Recommended Posts

hi all

 

I am rebuilding a site.

 

Basically I have a page which has 2 boxes on the right hand side which fill the screen

 

On Load one big is hidden

 

On click of a P tag, javascript runs, gets the available height (depending on the height of the window), divides by 2, then shows the 2nd div.

 

Then you click an X image on the 2nd div, and that div hides again, then resizes the first div to full height.

 

Works fine FIRST TIME

 

BUT

 

when I click the P tag the 2nd time (after hiding the div) it goes weird

Close the div, try third time, works perfect

Try fourth time, goes weird again

 

Example link

http://help.rideandtag.co.uk/main.php

 

Theres no PHP coding, so all can be seen via source code.

 

TRY it

 

1) Click "Show listing Demo" on the left hand side.

2) Blue box appears

3) Click the X on the top right of the BLUE box

4) Blue box goes

 

5) Click Show Listing Demo on left hand side again

6) WTF!!!!

7) Click the X again in the blue box)

8) Repeat from 1 and get same results

 

 

EDIT:// Console.log has some debug, shows the height being set to 0. Dont know why the maths does not equal 0

 

 

 

Link to comment
Share on other sites

Fixed it.

 

For some reason when I set the desc box to visible it was causing a scroll , thus pushing main down to float under sidebar, thus causing offset to be the height of the document.

Resulting is height of document minus offset of map (being below doc height) total 0. but by the time the debug spat the code out, it was back to the top, thus showing incorrect figures in the console log (and not showing a scroll bar)

 

Simple fix, set the width to 0 (so the scroll wont force the position below the page) at the start of the function and reset the width at the end

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.