ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Terrible flash of unstyled content problems.....jquery

July 09, 2007 10:00pm

Subscribe [2]
  • #1 / Jul 09, 2007 10:00pm

    afleming

    5 posts

    I’ve been experimenting with jquery on my site and I am having a difficult time with Safari and the famous FOUC. Unfortunately sometimes it happens and sometimes not and I can’t figure out what is going on. My only solution at this point is to take out jquery and try another approach.

    This has been giving me headaches for a couple of days now. The site is http://italartnet.com and the two sections causing problems are index and artists. jquery is set to react to a click on the headline as well as the sidebar with very simple code.

    Any ideas would be great,

    Alex

  • #2 / Jul 10, 2007 3:01am

    afleming

    5 posts

    Here is the jquery code-


        $(document).ready(function() {
    $("dd:not(:first)").hide();
    $("dt a").click(function(){
    $("dd:visible").slideUp("fast");
    $(this).parent().next().slideDown("slow"); return false;
    });
      });
    </script>



    $(document).ready(function() {
    $('.fulltext').hide();
    $('h3').click(function() {
    $(".fulltext").hide();
    $(this).parent().next().fadeIn(500);
    return false;
    });
          });
    </script>

    The problem is with the first .hide() on each script. This is causing the problem. Is there anyway to delay the execution of the script until the style sheet is loaded?

    Alex

  • #3 / Jul 10, 2007 7:31am

    afleming

    5 posts

    I seem to have fixed the problem…..fingers crossed as it is probably too early to tell. At least the Safari FOUC seems to be under control.  Now the Firefox issues….

    regards,

    Alex

  • #4 / Jul 10, 2007 7:36am

    Daniel Walton

    553 posts

    Good news, I’ve been quietly following this to see if any work-around comes about… if I may ask, what did you do to resolve it?

  • #5 / Jul 10, 2007 8:14am

    afleming

    5 posts

    I made some very subtle changes to the code as follows. I’m surprised that it works but it does. One of my test pages still has the flash with old code and the live page is working.

    </script>

        $(document).ready(function() {
    $("dd:not(:first)").css ('display','none');
    $("dt a").click(function(){
    $("dd:visible").slideUp("fast");
    $(this).parent().next().slideDown("slow"); return false;
    });
      });
    </script>



    $(document).ready(function() {
    $('div.fulltext').css ('display','none');
    $('h3').click(function() {
    $("div.fulltext").css('display','none');
    $(this).parent().next().fadeIn(500);
    return false;
    });
          });
    </script>

    It seems also that jquery is sensitive to spaces so make sure that the code is tight. Regardless, I still need to bang on this for few days before I am convinced. I was about to give up and look for another solution. The flashing was driving me crazy as it was so random.

    Alex

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases