开发者

AJAX content loader: it's SEO friendly, but what about bookmarks?

开发者 https://www.devze.com 2023-01-24 10:40 出处:网络
So I\'ve started tackling Javascript and jQuery, and I\'ve put together an event handler for certain link\'s \'click\' events; it takes the href and pulls the content from the appropriate \'#container

So I've started tackling Javascript and jQuery, and I've put together an event handler for certain link's 'click' events; it takes the href and pulls the content from the appropriate '#container' and loads it into the target container...

<script type="text/javascript">
        $(function(){
            $('#journeyNav li a').click(cLoad);
        });

        function cLoad(evt) {
            var cLoadURL = $(this).attr('href');
            if(!$(this).parent().hasClass('current')) {           
              $('#stageContentMain').stop().animate({opacity : 0},425, 'easeOutExpo', function(){
                  $('#stageContentMain').load(cLoadURL + " #stageContent", function() {
                      $('#stageCo开发者_C百科ntentMain').stop().animate({opacity : 1},425, 'easeOutExpo');
                  });
              });
            $(this).parent().siblings().removeClass('current');
            $(this).parent().addClass('current');
            return false;
            }
            else {
            return false;
            }
        }
</script>

Everything works great actually--especially for my first jQuery function, and second overall Javascript attempt. I am however looking to on Javascript enabled machines (the bookmarking wouldn't be a problem otherwise,) make bookmarking and the 'addthis' social sharing widget to work with the selected content.

Anyone have any ideas or tips?


Checkout the Ben Alman's hashchange event plugin

0

精彩评论

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