Jump to content

Recommended Posts

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>
Link to comment
https://forums.phpfreaks.com/topic/282416-keep-size-of-div-area-on-toggle/
Share on other sites

  • 2 weeks later...
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.