我正在为网站构建一个小型成就列表。我想知道是否有可能在一个js文档中列出该列表,然后根据他们获得的成就调用各自的字符串。这样我就可以将我的列表放在一个文档中,而将代码放在另一个文档中。我将如何去创造这个?从js文件中获取段落并将它们插入另一个js文件的div中
编辑: 好的,所以我会尽力解释一下我在脑海里所做的一切。
<p>Achievement 1 - Some text goes here as well</p>
<p>Achievement 2 - Some text goes here as well</p>
<p>Achievement 3 - Some text goes here as well</p>
<p>Achievement 4 - Some text goes here as well</p>
if(level === 5) {
$('#achievement2').animate({left:"10px"}, function(){
$(this).delay(3500).fadeOut(500).promise();
});
$('.achievementCont').append(Achievement 1);
}
请查看帮助页面,了解SO上的一个很好的问题。 – isherwood
也许这会帮助[http://stackoverflow.com/questions/6734552/newbie-question-connect-two-functions-int-two-files](http://stackoverflow.com/questions/6734552/newbie-question -connect - 双功能-INT-两个文件)。希望能帮助到你。 –
@isherwood我会提供代码,我有一个线索来做到这一点。 –