使用JQuery的FadeIn文本
“加载”这个词的语法是什么。。。在JSON数据显示之前淡入?现在,数据是隐藏的,没有显示任何内容使用JQuery的FadeIn文本,jquery,fadein,Jquery,Fadein,“加载”这个词的语法是什么。。。在JSON数据显示之前淡入?现在,数据是隐藏的,没有显示任何内容 a1.start = function(hookElementSelection, dataurlForJsonFile) { jQuery('<div/>', { id: 'loading', text: 'Loading...' }).appendTo(hookElementSelection); hookElementSelection.
a1.start = function(hookElementSelection, dataurlForJsonFile) {
jQuery('<div/>', {
id: 'loading',
text: 'Loading...'
}).appendTo(hookElementSelection);
hookElementSelection.hide();
$("hookElementSelection.loading").fadeIn("fast");
//resetting data in case this isnt the first run through
a1.products = {};
a1.recipes = {};
a1.suppliers = {};
a1.bakedRecipes = [];
//make an ajax call and wait for success
$.ajax({url:dataurlForJsonFile}).success(function(data) {
//get the recipe data
parseJSONData(data);
//put the recipes on the page
$.each(a1.recipes, function(i, recipe) {
recipe.render(hookElementSelection);
});
renderCalculator(hookElementSelection); //add in the final calculation logic
});
};
尝试更改hookElementSelection.hide$hookElementSelection.loading.fadeInfast;到 hookElementSelection.children.notloading.hide; hookElementSelection.findloading.fadeInfast
感谢,因为hookElementSelection被隐藏,更改了附加到其中的元素
jQuery('<div/>', {
id: 'loading',
text: 'Loading...'
}).appendTo($("body"));
$("#loading").fadeIn("slow");
是否添加了加载分区?其他数据如何?是的,添加了加载分区。JSON数据以前显示过,但现在隐藏了。我想淡入。很抱歉更改为hooklementselection.findloading.fadeInfast;抱歉,我错过了加载id不是类,将我的答案编辑为HI,请更改为hookElementSelection.children.notloading.hide;hookElementSelection.findloading.fadeInfast;看看这个。还编辑了答案听起来你想加载。。。文本淡入,延迟,然后被JSON数据替换。对吗?在JSON调用中添加.delay函数。