Jump to content

User:Zubachi/vector.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/* 

jQuery

TODO
========

* actually make this animate...



 

$(document).ready(function() {
    // console.log("DOM is ready!");
    // #mw-panel .portal hidden
    // #mw-panel width is 2em
    var openWidth            = "10em";
    var closedWidth          = "2em";
    var animationDuration    = 500;

    $("#mw-panel").hover(function() {
        // console.log("Hovering.");
        
        $(this).stop().animate({ width: openWidth }, animationDuration);
        // console.log("Panel opened!");
        
        $("#content").stop().animate({ marginLeft: openWidth }, animationDuration);
        // console.log("Content moved!");
        
        $("#left-navigation").stop().animate({ marginLeft: openWidth }, animationDuration);
        // console.log("Nav moved!");
        
        $("#mw-panel .portal").show();
        // console.log("You're portals are showing...");
    }, function() {
        // console.log("Mouse leaving.");
        
        $(this).stop().animate({ width: closedWidth }, animationDuration);
        // console.log("Panel closed");
        
        $("#content").stop().animate({ marginLeft: closedWidth }, animationDuration);
        // console.log("Content returned");
        
        $("#left-navigation").stop().animate({ marginLeft: "0" }, animationDuration);
        // console.log("Nav returned");
        
        $("#mw-panel .portal").hide();
        // console.log("Where'd my portals go?");
    });


});