History/Remote is not supposed to work that way. Although the hash is
changing correctly it will not work in IE for example. You need to
explicitly tell the history manager which links add to history. Just
have a look at the demo. For pure Ajax loading links that is the
remote method. In your case

$('a.testing').remote('#div2', function() {
    //callback
});

$.ajaxHistory.initialize();

The show/hide of div1/div2 looks to me like a workaround you don't
need but I'm not sure.

--Klaus


On 6 Okt., 22:52, Leanan <[EMAIL PROTECTED]> wrote:
> Klaus,
>
> I've created a demo that exhibits this behavior.  I modified your demo
> that is included with the script athttp://www.stilbuero.de/jquery/history/
>
> All you should have to do is change your index.html to be the
> following:
>
> <html lang="en">
>   <head>
>       <meta http-equiv="Content-Type" content="text/html;
> charset=utf-8">
>       <meta http-equiv="Content-Style-Type" content="text/css">
>       <meta http-equiv="Content-Script-Type" content="text/
> javascript">
>       <title>jQuery history/remote - solution for hijaxing links</
> title>
>       <script src="jquery-1.1.3.1.pack.js" type="text/javascript"></
> script>
>       <script src="jquery.history_remote.js" type="text/javascript"></
> script>
>   </head>
>   <body>
>
>     <div id="div1">
>       <a href="#test1" class="testing" id="Chap1">Test Chap1</a><br>
>       <a href="#test2" class="testing" id="Chap2">Test Chap2</a><br>
>       <a href="#test3" class="testing" id="Chap3">Test Chap3</a><br>
>     </div>
>
>     <div id="div2"> </div>
>     <script type="text/javascript">
>       $(document).ready(function() {
>         $.ajaxHistory.initialize(function() {
>           $('#div1').show();
>           $('#div2').hide();
>         });
>
>         $('.testing').click(function() {
>           if ($(this).attr('id') == "Chap1") {
>             $.get('chapter-1.html', function(data) {
>               $('#div2').append(data);
>               $('#div1').hide();
>               $('#div2').show();
>             });
>           }
>           if ($(this).attr('id') == "Chap2") {
>             $.get('chapter-2.html', function(data) {
>               $('#div2').append(data);
>               $('#div1').hide();
>               $('#div2').show();
>             });
>           }
>           if ($(this).attr('id') == "Chap1") {
>             $.get('chapter-1.html', function(data) {
>               $('#div2').append(data);
>               $('#div1').hide();
>               $('#div2').show();
>             });
>           }
>         });
>       });
>     </script>
>   </body>
> </html>
>
> You should notice that every time you click on the Test links, you
> will actually get the html page twice instead of once.

Reply via email to