Skip to content

Commit

Permalink
Merge pull request jquery#34 from eddiemonge/patch-1
Browse files Browse the repository at this point in the history
Fix the all projects dropdown
  • Loading branch information
addyosmani committed Dec 14, 2011
2 parents fafd70e + 134fc0f commit f24edf9
Showing 1 changed file with 17 additions and 22 deletions.
39 changes: 17 additions & 22 deletions content/assets/js/scripts.js
@@ -1,4 +1,3 @@

/*******************************************************************************/
/* Subscriptions */
/*******************************************************************************/
Expand Down Expand Up @@ -41,30 +40,26 @@ App.subscribe("init", function(){
//
// Project Select Show/Hide
//
$(".toggle-projects").bind("click", function(e){
$(".toggle-projects").bind( "click", function( e ) {
e.preventDefault();
var el = $(this);
if(el.hasClass('active')){
el.removeClass('active');
$("body").css({"marginTop":"0"});
el.removeClass('down');
} else {
el.addClass('active');
$("body").css({"marginTop":"150px"});
el.addClass('down');
}

var el = $( this ).toggleClass("active");

$("body").animate({ "marginTop": ( el.hasClass("active") ? "150px" : "0" ) }, 300, function() {
el.toggleClass("down");
});
});

//

// Project Select Clickoutside
//
$(".project-select").bind("clickoutside", function(e, el){
var target = $(".toggle-projects");
if($(el).parent(".toggle-projects").length != 1){
if(target.hasClass('down')){
target.removeClass("active down");
$("body").css({"marginTop":"0"}, 300);
}
$(".project-select").bind( "clickoutside", function( e ) {
var el = $(".toggle-projects");

if ( e.target.parentNode === el[0] || e.target === el[0] ) {
return;
}

if ( el.hasClass("down") ) {
el.click();
}
});

Expand Down

0 comments on commit f24edf9

Please sign in to comment.