Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder MrBiggZ's Avatar
    Join Date
    Apr 2005
    Location
    Indianapolis IN
    Posts
    275
    Thanks
    39
    Thanked 0 Times in 0 Posts

    Jquery div hide/show question

    Greetings!

    First off I am not a javascript person. I follow examples and try my best message what is in front of me.

    This page : http://ftsc-test.handlersspot.net/ui/dynamic-data.html

    When the div shows it starts out at the left then snaps to the center. Where I was to believe it would just when activated show in the center.

    This is what I'm not understanding!

    Help is always appreciated!
    “No matter how slick the demo is in rehearsal, when you do it in front of a live audience, the probability of a flawless presentation is inversely proportional to the number of people watching, raised to the power of the amount of money involved.” ~ Mark Gibbs

  • #2
    Regular Coder
    Join Date
    Apr 2005
    Location
    Texas
    Posts
    448
    Thanks
    24
    Thanked 63 Times in 63 Posts
    the css rule that you used to center the div margin: 0 auto; works by using the dimensions of the div to center it, how ever if jQuery sets the width dimension to 0px in the $("div").hide(); function it would effectively move the div to the left of its container.

    I would test this by changing the auto margin rule to a static left:50px . If it starts at 50px, and doesn't jump on completion: you have your answer.
    Allwisend bin ich nicht, doch viel ist mir bewursst
    -Goethe

  • #3
    Regular Coder MrBiggZ's Avatar
    Join Date
    Apr 2005
    Location
    Indianapolis IN
    Posts
    275
    Thanks
    39
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by blaze4218 View Post
    the css rule that you used to center the div margin: 0 auto; works by using the dimensions of the div to center it, how ever if jQuery sets the width dimension to 0px in the $("div").hide(); function it would effectively move the div to the left of its container.

    I would test this by changing the auto margin rule to a static left:50px . If it starts at 50px, and doesn't jump on completion: you have your answer.
    Nope, got the same results.

    You know maybe I should just make the myDiv_1, 2, 3 & 4 div's a container and then put a div (which I can center) within that div. And let the myDiv have a 100% width. I think this will make my life a bit easier to manage!
    “No matter how slick the demo is in rehearsal, when you do it in front of a live audience, the probability of a flawless presentation is inversely proportional to the number of people watching, raised to the power of the amount of money involved.” ~ Mark Gibbs


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •