2

I developing a site using jQuery, CSS and HTML. The page has on the left side a static menu which should always be shown and a content div. When I press a link in the menu right now, the whole page animates and slides to left revealing the div which the menu element links to using href. I would very much like to modify this so only the content div animates and is replaced. Is this possible?

Regards

4

1 回答 1

1

是的,这是可能的。没有一些代码,我能给你的就不多了。这是我能得到的通用的:

$(".menuLink").click(function() {
    var linkedContent = ...identify the content being moved into view...
    var currentContent = ...identify the content being moved from view...

    var moveOldTo = "-=" + currentContent.width() + "px";
    //assuming your content divs are relatively positioned
    currentContent.animate({ left: moveOldTo }, 1000);

    var moveNewTo = "-=" + linkedContent.width() + "px";
    linkedContent.animate({ left: moveNewTo }, 1000);
});
于 2012-10-23T21:30:35.210 回答