我在我的angular 6项目中使用jQuery,一切都充满了幸福。除了一个微小的细节,Web应用程序的主页都会显示:从一开始就没有显示... 我会尝试用代码更好地表达它:
/*Here I have the css for a list (the page is almost
entirely this list), and as you can see, the list is not
displaying, that's because i have jquery code to slideDown
the list*/
ul.items li
{
background-color: #202020;
opacity: .8;
font-size: 25px;
font-weight: bold;
color: white;
display: none;
};
您可以在此处看到提到的jquery代码:
$(document).ready(function(){
$('a').click(function(){
$('ul.items li').slideDown("slow")
})
});
该代码运行良好,但是我希望仅当用户通过单击站点内的主页链接进入主页时才使用它。当用户在浏览器中输入链接并首先查看网站时,我希望该应用程序弹出以显示列表
我尝试使用类似的功能来实现它:
function fistLook(counter)
{
var element = document.querySelector("div");
if (counter == 0)
{
element.style.display = 'auto';
}
};
但是我无法设置此计数器,甚至无法调用component.html内部的函数
因此,我在这里寻求支持,因为有关此问题的其他问题对我而言并没有做到。因此,我如何使初始显示为“自动”,并且用户单击该页面后其显示为“ 0”?