javascript - How is this content displayed in blocks? Why can't I test it?
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-05-16 13:16:49
0
2
373

How does this single page display content in blocks?

I put it

<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js"></script>
<script>
$(function(){
    $("#nav a").click(function(){
        href = $(this).attr('href');
        if (href.slice(0, 1)=='#') {
            type = href.slice(1);
            $(".content").fadeOut(350);
            $("#content-" + type).fadeIn(350);
        }
    });
});
</script>
<style>

.content {
    padding-left: 20px;
    display: none;
    position: absolute;
    top: 0;
    left: 0;
}
</style>

Took these two pieces down,
Then my settings are set like this
Navigation

<p id="nav" style="margin-bottom:20px">
    <a href="#product-jichu" class="summary current">基本信息</a>
    <a href="#product-canshu" class="desc">详情</a>
    <a href="#product-pinglun" class="review">评价</a>

</p>

content

<p class="content" id="content-product-info" style="display:block;">
测试页面1
</p>
<p class="content" id="content-product-canshu">
测试页面2
</p>
<p class="content" id="content-product-pinglun">
测试页面3
</p>

Why can't this have the same effect as him?
It was displayed when I opened it, and then everything disappeared after clicking the navigation. Is there anything wrong?

曾经蜡笔没有小新
曾经蜡笔没有小新

reply all(2)
漂亮男人

The id suffix of test page 1 is inconsistent with the one in a

黄舟

Okay, it’s still my own problem. I don’t know why the content in the script was swallowed by the program

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template