我有一些我一直在使用的代码,它是通过不同来源编写的代码汇编。我是JavaScript的初学者,我遇到了对代码进行最后更改的问题。我不需要加载文件夹标签中写的文本名称,而是需要编写一些HTML。
以下是我目前的情况:
$(function () {
$(".folderContent").hide();
//arrange the background image starting position for all the rows.
//This will allow the background image cut illusion when showing the folder content panel
$(".row").each(function () {
$(this).css({
backgroundPosition: "0px -" + $(this).index() * $(this).outerHeight() + "px"
});
});
//when a folder is clicked,
//position the content folder after the clicked row
//and toggle all folder / app icon that is not the one clicked.
//and toggle the folder content panel
$(".folder").click(function (event) {
var folderContent = $(".folderContent");
folderContent.remove();
var folderContentShown = folderContent.css("display") != "none";
var clickedFolder = $(this);
clickedFolder.parent(".row").after(folderContent);
folderContent.find(".folderName").text($(this).text());
$("body").find(".folder, .app").not(clickedFolder).each(function () {
if (!folderContentShown) $(this).animate({
opacity: 0.00
}, "fast");
else $(this).animate({
opacity: 1.00
}, "fast");
});
//clickedFolder.animate({opacity: folderContentShown ? 1.00 : 0.70}, "fast");
folderContent.slideToggle("fast");
event.preventDefault();
});
});
我不需要以文本形式返回folderName,而是需要返回HTML以在folderContent区域中显示。