SitePoint Sponsor

User Tag List

Results 1 to 17 of 17
  1. #1
    SitePoint Member
    Join Date
    Apr 2013
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Jquery.load $ajax loads content then dissapears

    hi guys new to this forum is any of you guys can help that would be super...

    i have a main index page with a div where i inject my external pages to.. when the page opens the slider at the top of the screen works fine.. when i click work, and then click home again. my slider dissapers after a few seconds or when you click the arrows.. having a nightmare been out it for days.. my general.js is located in the main index page..

    www.alexcallow.com

    i think its something to do with my ajax call, not sure though.. really am stuck

    $.ajax({
    url: "page/index.php",

    success: function( data ) {

    // Execute slide here after content has loaded;
    $('#slider-id').liquidSlider({
    autoSlide:true,
    autoSlideInterval: 7000,
    autoHeight:false,
    dynamicTabs: false,

    });
    }

    main index page - http://pastie.org/private/nymfbdsuau9amxjtcmxu1g
    external home page - http://pastie.org/private/f9zxpvv2wvm1skz2mmybsq
    external work page - http://pastie.org/private/zwvcnb4i9cjs8vfpnttq
    general.js - http://pastie.org/private/71rbckmrkrqytsogdxitcw

  2. #2
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,889
    Mentioned
    210 Post(s)
    Tagged
    12 Thread(s)
    Hi there,

    Welcome to the forums

    When I check out your page with the console open, then click on "Work", I see the following error:

    Code:
    Uncaught TypeError: Cannot set property 'innerHTML' of null - blogger.js:12
    It's probably a good idea to fix this before trying to troubleshoot your main problem.

    Further inspection shows this line in blogger.js to be the culprit:

    Code JavaScript:
    document.getElementById('twitter_update_list').innerHTML = statusHTML.join('');

    So either create the element, or temporarily remove the blogger script from your page and see if that makes a difference.

  3. #3
    SitePoint Member
    Join Date
    Apr 2013
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    just tried what you said and its not that.. removed the link.. the website works fine with the error. just having a problem when i go from home page to another page and then back the home page, the slider yanks up and then works for couple of seconds and then vanishes.. so annoying. cant seem to work it out..

  4. #4
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,889
    Mentioned
    210 Post(s)
    Tagged
    12 Thread(s)
    Shame!
    I didn't think it would be that, but it's wise to correct all obvious JS errors on a page before trying to troubleshoot anything.

    I'll try and get your page working locally, so I can have a poke around with it and let you know if I find anything.

  5. #5
    SitePoint Member
    Join Date
    Apr 2013
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thats brillant, if you could that would be amazing if you could really struggling...

  6. #6
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,889
    Mentioned
    210 Post(s)
    Tagged
    12 Thread(s)
    Hi there,

    I managed to set up a copy of your site running locally, but there is one problem.
    The issue only appears sporadically. Sometimes the slider behaves as it should, sometimes it jumps off the page.
    The same is true for your site.

    Do you have a way to reproduce this every time?

  7. #7
    SitePoint Member
    Join Date
    Apr 2013
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thats exactly what happen for me to, not sure why this is happening. any way i can upload my root file and send it to you

    the slider is from http://liquidslider.kevinbatdorf.com/

  8. #8
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,889
    Mentioned
    210 Post(s)
    Tagged
    12 Thread(s)
    Hi,

    So, it seems that something on your page is programatically setting the width of the <div> element with the id of "slider-id-wrapper" to zero.
    I couldn't work out if this was a JavaScript or a media query, but you can see what I mean, by making the slider vanish, then using (for example) the Chrome web inspector to inspect this element.
    You will see an inline style of "width:0px". Remove this and your slider will reappear.

    Anyway, a really quick and dirty fix, would be to add this inside your $(document).ready in general.js.

    Code JavaScript:
    setInterval(function(){
      if($('#slider-id-wrapper').css("width") == "0px"){
        $('#slider-id-wrapper').css("width", "auto")
      };
    }, 250);

    However, if I was you, I would try to get to the bottom of this.
    Try stripping out all of the unnecessary styles and scripts until you find what is doing this.
    You might also consider having a look at a different responsive slider: http://visionwidget.com/responsive-j...slideshow.html

    Sorry I couldn't help more.

  9. #9
    SitePoint Member
    Join Date
    Apr 2013
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no thanks thats great help, you have pointed me out in to the right direction ill have a look into it and get back to you...

    thanks again

  10. #10
    SitePoint Member
    Join Date
    Apr 2013
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    me again.. said what you do and put a different slider in there.. works a bit better but it seems as though i have the same problem.. content seems to load before the page has a chance to finish thats why i get the flash effect i think not sure where to go from here though.. think its something to do with my js file..

    http://pastie.org/private/50ntex2xxrscy6ydghthyq

    need to load the content after the page has finished executing all the jquery executions

  11. #11
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,889
    Mentioned
    210 Post(s)
    Tagged
    12 Thread(s)
    Hi there,

    Can you post a link to the same page with a different slider.
    That would be helpful for debugging.

  12. #12
    SitePoint Member
    Join Date
    Apr 2013
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    here you go.. thanks for sticking with me

    alexcallow.com

    heres my js file in a pastie http://pastie.org/private/upwitue960r3sk7fdkwytq

  13. #13
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,889
    Mentioned
    210 Post(s)
    Tagged
    12 Thread(s)
    Hi there,

    I'm sorry, but I just spent the last 10 minutes navigating from "Home" to "Work" (and refreshing the page for good measure) and I couldn't once reproduce the issue.

    How often can you reproduce it?
    Are you reproducing it with the same steps as before?

  14. #14
    SitePoint Member
    Join Date
    Apr 2013
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    when ive just spent half hour trying to solve this.. just emptied my cache and im not getting the problem any more either.. think i might have fixed the problem.... if your not getting the problem either maybe we have solved it..

    thanks for your hard work

  15. #15
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,889
    Mentioned
    210 Post(s)
    Tagged
    12 Thread(s)
    No problem.
    Thanks for letting me know that you've (hopefully) got it sorted

  16. #16
    SitePoint Member
    Join Date
    Apr 2013
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no worries.. thanks for sticking with me.. hopefully one day i can return the favour

  17. #17
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,889
    Mentioned
    210 Post(s)
    Tagged
    12 Thread(s)
    You don't have to return the favour so much as pass it on
    Seriously, it's great to see people hanging around and helping others.


Tags for this Thread

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
  •