-
combining 2 functions
hi,
i gotta say i have 0 to no skill in JS
but willing to learn
so i got these 2 functions and am looking to combine
they work exactly the same so i think it should be possible but got no idea
and secondly when i call the removeClass another popup is called automatically
Code:
function deselect() {
$(".pop").slideFadeToggle(function() {
$().removeClass("selected");
alert("break operation");
break();
});
}
$(function() {
/*share*/
$(".popup.share").live('click', function() {
if($(this).hasClass("selected")) {
deselect();
} else {
$(this).addClass("selected");
$(".share").slideFadeToggle(function() {
});
}
return false;
});
/*info*/
$(".popup.info").live('click', function() {
if($(this).hasClass("selected")) {
deselect();
} else {
$(this).addClass("selected");
$(".info").slideFadeToggle(function() {
});
}
return false;
});
$(".close").live('click', function() {
deselect();
//alert("colos");
return false;
});
});
$.fn.slideFadeToggle = function(easing, callback) {
return this.animate({ opacity: 'toggle', height: 'toggle' }, "fast", easing, callback);
};