开发者

bbq.pushState() with jQuery load

开发者 https://www.devze.com 2023-04-12 01:18 出处:网络
I am building my website with dynamically loading content. I have this code right now for pushState()

I am building my website with dynamically loading content. I have this code right now for pushState()

$("a.link").cli开发者_StackOverflow社区ck(function(e) { 

        var href = $(this).attr( "href" );
          $.bbq.pushState({ url: href });
          return false;
        });

         $(window).bind( "hashchange", function(e) {
            var url = e.getState( "url" );
            $("a").each(function(){
              var href = $(this).attr( "href" );
            });
          });

          $(window).trigger( "hashchange" );

What I want to do is to be able to do the same thing, but have it trigger the jQuery.load() function.

In other words, I want to be able to click a link that looks like <a href="about.php">About</a> and have the div with the id of wrapper dynamically load the a's href.

How can I do this?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号