Код: Выделить всё
//Remove todos os elementos relacionados a frete
function removeAllFrete(callback){
var a = $(".remove-frete").length;
for (i = 0; i < a; ++i) {
$(".remove-frete").each(function(){
$(this).animate({
opacity: 0
}, function(){
$(this).slideUp(function(){
$(this).remove();
});
});
if ( i == a - 1 && typeof(callback) === "function" ){
return(callback());
}
});
}
}
//Exibe o formulário de busca de CEP
function buscarCEP(msg, callback){
function showSearchForm(){
el = $("")
$(".frete-cont").append(el);
el.slideDown(function(){
$(this).animate({
opacity: 1
}, function(){
$("#frete-search-trigger").on("click", function(e){
e.preventDefault();
removeAllFrete();
});
});
});
}
if ( msg != null){
var elR = $("" + msg + "");
$(".frete-cont").append(elR);
elR.slideDown(function(){
$(this).animate({
opacity: 1
}, function(){
showSearchForm();
});
});
} else{
showSearchForm();
}
}
$("#frete-forget-trigger").on("click", function(e){
e.preventDefault();
console.log("a");
if( $(".frete-form").length ){
console.log("1");
removeAllFrete();
} else{
removeAllFrete(function(){
console.log("2");
buscarCEP(null);
});
}
});
Есть идеи, что может быть?
Моя ошибка, проверьте мой ответ ниже...
Здесь вы можете найти скрипку: http://jsfiddle.net/5hjhxm09/4/
Подробнее здесь: https://stackoverflow.com/questions/316 ... -wont-work
Мобильная версия