Jump to content


Photo

Keep size of div area on toggle


  • Please log in to reply
2 replies to this topic

#1 frshjb373

frshjb373

    Advanced Member

  • Members
  • PipPipPip
  • 42 posts

Posted 24 September 2013 - 10:55 AM

I have the following code. Functionally, it's working great, but when you toggle between button 1 and button 2 and the div slides into position, the size of the div collapses.  I'd like to make it so that the page doesn't resize when toggling back and forth.  I'm figuring this is an easy fix, but I can't seem to get it right.  Code is below. Any help is much appreciated.  Thank you in advance!

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

<script>
$(function () {
    $("[name=toggler]").click(function () {
        $('.toHide').hide();
        $("#blk-" + $(this).val()).show('slide');
    });
});
</script>
<label>
    <input id="rdb1" type="button" name="toggler" value="1" />
</label>
<label>
    <input id="rdb2" type="button" name="toggler" value="2" />
</label>


<div id="blk-0" class="toHide">
<div class="center-form-img" >
<img src="{{media url="wysiwyg/form-inactive.jpg"}}" alt="" />
</div>
</div>
<div id="blk-1" class="toHide" style="display:none"> {{block type=core/template name=ContactUs template=cmg/ContactUs1.phtml}}</div>
<div id="blk-2" class="toHide" style="display:none">{{block type=core/template name=ContactUs template=cmg/ContactUs2.phtml}}</div>


#2 lilmer

lilmer

    Advanced Member

  • Members
  • PipPipPip
  • 100 posts
  • LocationSomewhere here in the universe.

Posted 08 October 2013 - 07:31 PM

Why don't you add container div for the slider that has the fix height or width.



#3 fastsol

fastsol

    Advanced Member

  • Members
  • PipPipPip
  • 436 posts
  • LocationMinnesota

Posted 08 October 2013 - 07:59 PM

You could add a height dimension to a wrapper div once a button is clicked using jquery.


You never know everything, I learn everday!

http://amecms.com

http://amewebdesigns.com





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com