开发者

Open Jquery Div on another page "Hash"

开发者 https://www.devze.com 2023-02-27 00:39 出处:网络
I want to open a div on a different page by using a link. The links look like this: grid.html # project1 / 2 / 3 / 4 etc..

I want to open a div on a different page by using a link.

The links look like this: grid.html # project1 / 2 / 3 / 4 etc..

The code looks like this on the target page:

    $(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').anima开发者_如何学编程te({'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
    });



});


var hash = window.location.hash;
var yourDiv = $('#content .'+hash);
0

精彩评论

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