Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 2 of 2 FirstFirst 1 2
Results 11 to 20 of 20
  1. #11
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    Ya know, I had a similar problem like that once. Troubleshot and messed with code for 3 hours. Discovered I had placed the script I wrote before the call for the jQuery library in my code. Swapped them and they worked just fine.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  2.  

  3. #12
    Junior Member
    Join Date
    Dec 2012
    Posts
    29
    Member #
    34228
    Quote Originally Posted by Ronald Roe, post: 246732
    Ya know, I had a similar problem like that once. Troubleshot and messed with code for 3 hours. Discovered I had placed the script I wrote before the call for the jQuery library in my code. Swapped them and they worked just fine.
    I tried that after you advised and it didn't resolve the issue. If you go to www.danperceval.com, you'll see that the image slider (of the cars ) works on the main content area. But if you click on ABOUT, it doesn't work, but the CSS does seem to work. And in Chrome and Safari, the image slider just doesn't work period, even on page load. Any other ideas? I wonder if this has anything to do with z-index, although I doubt it. I'm about to give up on this dynamic load page bullcrap.

  4. #13
    Member
    Join Date
    Nov 2012
    Location
    Tampa. FL
    Posts
    59
    Member #
    33844
    Liked
    21 times
    I'm pretty sure it's the way you are loading the jQuery that is causing the problem. Your code is in a function that is never called because it has no trigger (this is why we use document.ready which calls the function when "ready" is fired-- the DOM is loaded). I altered your code to make sure that it gets called which should get it working on the other browsers:
    Code:
    $(document).ready(function() {
        if(Modernizr.history){
        var newHash      = "",
            $mainContent = $("#main-content-window"),
            $pageWrap    = $("#container"),
            baseHeight  = 0,
            $el;
        $pageWrap.height($pageWrap.height());
        baseHeight = $pageWrap.height() - $mainContent.height();
        $("nav1").delegate("a", "click", function() {
            _link = $(this).attr("href");
            history.pushState(null, null, _link);
            loadContent(_link);
            return false;
        });
        function loadContent(href){
            $mainContent
                    .find("#load-content")
                    .fadeOut(200, function() {
                        $mainContent.hide().load(href + " #load-content", function() {
                            $mainContent.fadeIn(200, function() {
                                $pageWrap.animate({
                                    height: baseHeight + $mainContent.height() + "px"
                                });
                            });
                            $("nav1 a").removeClass("current");
                            console.log(href);
                            $("nav1 a[href$="+href+"]").addClass("current");
                        });
                    });
        }
        $(window).bind('popstate', function(){
          _link = location.pathname.replace(/^.*[\\\/]/, ''); //get filename only
          loadContent(_link);
        });
    } // otherwise, history is not supported, so nothing fancy here.
    });
    Then, the reason that your script stops working on other pages is because of the way the script is loaded on dynamic content. Scripts only run once on an element unless they are told otherwise. What's happening is, you are running a script on an element in the DOM then changing the DOM when you load the new content. Probably the best way to fix that is to call a function at the end of your ".load" event that will load (or reload) the proper functionality for the element you just added.
    Freelance Web Developer

  5. #14
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    IIRC, doesn't jQuery assume (document).ready when another trigger isn't specified? I don't use a trigger unless I need a specific one, and I have no issues.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  6. #15
    Member
    Join Date
    Nov 2012
    Location
    Tampa. FL
    Posts
    59
    Member #
    33844
    Liked
    21 times
    My understanding is that it depends on what you are manipulating and the order in which the page loads. jQuery will run a script in an anonymous function even if the DOM hierarchy is not yet established or images are loaded. Some selectors may not be available at this time because they depend on the hierarchy of the DOM (child and sibling selectors).

    On a small page it probably doesn't make any difference. But, if you have a large page with a lot of big images or dynamic content, it's probably better to wait until the DOM is ready.
    Ronald Roe likes this.
    Freelance Web Developer

  7. #16
    Junior Member
    Join Date
    Dec 2012
    Posts
    29
    Member #
    34228
    I don't understand what to do at this point. The main reason why I wanted to use dhtml to load content into the main content region is because I didn't want to use old technology such as iframes. Also, I wanted to be able to connected Youtube playlists to my website and have my website automatically fetch the most up-to-date playlists and added videos without me having to making changes to the content. And lastly, I'm trying to modernize my website. My old website is www.XtremeIceSkating.com And you can tell it's ancient history already.

    I need everyone's opinion as to HOW I should load content into my page? Should I just use SSI's and make 30-40 individual pages and link to them? Should I use Jquery and load only the needed content into one page (index.shtml)? What's the best practice?

  8. #17
    Member
    Join Date
    Nov 2012
    Location
    Tampa. FL
    Posts
    59
    Member #
    33844
    Liked
    21 times
    It looks like you are loading jquery 1.8 then jquery 1.4 (you need to remove line 16 of your code where you are loading version 1.4).

    Also, you have gotten a little confused with your jquery function toggleup() which should either be slideup() or slidetoggle().

    That is causing an uncaught reference error and stopping your script.
    Freelance Web Developer

  9. #18
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,733
    Member #
    5580
    Liked
    718 times
    Dan ... this weekend is the 2nd year for Red Bull Crashed Ice Competition in St. Paul, Minnesota:
    http://www.redbull.com/cs/Satellite/...01243132123131

    They have videos posted from last year's competition. crazy


  10. #19
    Junior Member
    Join Date
    Dec 2012
    Posts
    29
    Member #
    34228
    Quote Originally Posted by mlseim, post: 246943
    Dan ... this weekend is the 2nd year for Red Bull Crashed Ice Competition in St. Paul, Minnesota:
    http://www.redbull.com/cs/Satellite/...01243132123131

    They have videos posted from last year's competition. crazy
    Thanks mlseim. I've never been big into that stuff. I like to stick to artistic crazy stuff.

  11. #20
    Junior Member
    Join Date
    Dec 2012
    Posts
    29
    Member #
    34228
    I think I'm going to give up with this "load content into a div" task because even if I was smart enough to figure out how to get it to work with Jquery, I still have the problem of visitors typing in directory address such as "www.danperceval.com/tricks.shtml" and not seeing the entire page, only the content of that page which would only be the div content. And to fix THAT problem, would require creative coding which I couldn't do if my life depended on it. Anyways, thanks for the help on this stuff.


Page 2 of 2 FirstFirst 1 2

Remove Ads

Posting Permissions

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

Search tags for this page

html menu options load content

,

page2 result load html

Click on a term to search for related topics.
All times are GMT -6. The time now is 05:33 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com