SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2005
    Location
    Palo Alto, CA
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Minimize this script? It doens't work on FF but works on chrome

    Can someone look at this and show me how to boil it down into a few lines.. it should probably only be 10 lines or so... not 40....

    Also, the script works fine in chrome but it seems to not work in Firefox.

    Thanks for your help!

    Code:
            $(document).ready(function () {
                if ($(window).width() < 1150){
                    /* hide comment bar if window too small */
                    jQuery.event.add(window, "load", resizeFrame1);
                    jQuery.event.add(window, "resize", resizeFrame1);
                    function resizeFrame1()
                    {
                        $('#right-wrapper').hide();
                        $("#left-wrapper").css('width',  $(window).width());
                    }
                }else{
                    /* resize the left-wrapper to make room for the right-wrapper */
                    jQuery.event.add(window, "load", resizeFrame2);
                    jQuery.event.add(window, "resize", resizeFrame2);
                    function resizeFrame2()
                    {
                        $('#right-wrapper').show();
                        $("#left-wrapper").css('width',($(window).width()-$("#right-wrapper").width()));
                    }
                }
            });
            $(window).resize(function () {
                if ($(window).width() < 1150){
                    /* hide comment bar if window too small */
                    jQuery.event.add(window, "load", resizeFrame3);
                    jQuery.event.add(window, "resize", resizeFrame3);
                    function resizeFrame3()
                    {
                        $('#right-wrapper').hide();
                        $("#left-wrapper").css('width',  $(window).width());
                    }
                }else{
                    /* resize the left-wrapper to make room for the right-wrapper */
                    jQuery.event.add(window, "load", resizeFrame4);
                    jQuery.event.add(window, "resize", resizeFrame4);
                    function resizeFrame4()
                    {
                        $('#right-wrapper').show();
                        $("#left-wrapper").css('width',($(window).width()-$("#right-wrapper").width()));
                    }
                }
            });

  2. #2
    SitePoint Enthusiast
    Join Date
    Jul 2005
    Location
    Palo Alto, CA
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nevermind... here's the fix:
    Code:
                $(document).ready(function () {
                    $(window).resize(function () {
                        if ($(window).width() < 1150){
                            $(window).bind("load resize", function() {
                                $('#right-wrapper').hide();
                                $("#left-wrapper").css('width',  $(window).width());
                            }
                        )}
                        else{
                           $(window).bind("load resize", function() {
                                $('#right-wrapper').show();
                                $("#left-wrapper").css('width',($(window).width()-$("#right-wrapper").width()));
                            });
                        }
                    });
                    $(window).trigger('resize');
                });


Bookmarks

Posting Permissions

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