Откройте Jquery Div на другой странице "Хэш" - PullRequest
0 голосов
/ 20 апреля 2011

Я хочу открыть div на другой странице, используя ссылку.

Ссылки выглядят так: grid.html # project1 / 2/3/4 и т. Д.

Код выглядит на целевой странице следующим образом:

    $(function(){



    // Thumbs
    $('#thumbs a').hover(function(){
        $(this).find('span').stop(true, true).animate({'top': '90px'}, 300)
    },  function(){
        $(this).find('img').stop(true, true).animate({}, 300);
        $(this).find('span').stop(true, true).animate({'top': '124px'}, 300)
    })  .bind('click', function(){
        $('#content .project').stop(true, true).fadeOut(500);
        $($(this).attr('href')).stop(true, true).css('left', 0).fadeIn(500);

        $('#content').animate({'min-height' : '450px', 'display' : 'inline', 'position' : 'relative', 'paddingTop' : '-2px' , 'paddingBottom' : '130px'}, 500); 

        $('#thumbs').animate({'marginTop' : '30px'}, 500);
        $('html,body').animate({scrollTop:0}, 500); 


        return false;
    });

  $(".close").click(function() {
        $('#content .project').fadeOut(500);
        $('#content').animate({'min-height' : '0px', 'display' : 'inline', 'position' : 'relative', 'paddingTop' : '0px' , 'paddingBottom' : '0px'}, 500); 
  });   

    // Carousel
    $('.carousel').jcarousel({
        scroll: 1,
        animation: 800,
        easing: 'easeOutQuart', 
        buttonNextHTML: '<div><div></div></div>',
        buttonPrevHTML: '<div><div></div></div>',
        initCallback: initCarousel
    });



});

1 Ответ

0 голосов
/ 20 апреля 2011
var hash = window.location.hash;
var yourDiv = $('#content .'+hash);
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...