0

这是我的代码......当我点击productsbutton它应该显示子菜单:food shoes cloths当我点击,说食物,然后swfobj应该用相应的 xmlfile 数据填充并且画廊是可见的......
默认情况下点击产品画廊应该显示food.xml产品,但没有任何反应。
请帮忙。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>TEST</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
</head>

<body>
    <aside>
        <div class=sidebar>
            <ul class=nav>
                <li class="home active" data-class="page_home">HOME</li>
                <li class="products" data-class="page_products">BYE</li>
                <li class="ART" data-class="page_art">ART</li>
            </ul>
        </div>
    </aside>
    <article>
        <div class="page_home show">
            <div class="myhome">
                <h1>Home</h1>
                <p> this is the index page </p>
            </div>
        </div>
        <div class="page_products">
            <ul class="productcat">
                <li class="food" data-class="page_food">FOOD</li>
                <li class="shoes" data-lass="page_shoes">SHOES</li>
                <li class="cloths" data-class="page_cloths">CLOTHS</li>
            </ul>
        </div>
        <div class="page_art">
            <div class="myart">
                <h1>ART</h1>
                <p>this is art page</p>
            </div>
        </div>
    </article>

    <script>
        $("ul.nav li").on('click', function (e) {
            var $this = $(this),
                // Class of the one to be shown
                clazz = $this.data("class");

            $this.addClass('active').siblings().removeClass('active');

            $('article > div').removeClass('show');
            $('.' + clazz).addClass('show');

        });
    </script> 
    <script>
        $("ul.productcat li").on('click', function (e) {
            var $this = $(this),
                // Class of the one to be shown
                subclazz = $this.data("class");

            $this.addClass('active').siblings().removeClass('active');

            $('article > div').removeClass('show');
            $('.' + subclazz).addClass('show');
            mygallery(subclazz);
        });
    </script> 
    function mygallery(config){ 
    <script type="text/javascript" src="gallery/js/jquery.js"></script> 
    <script type="text/javascript" src="gallery/js/swfobject.js"></script> 
    <script type="text/javascript" src="gallery/js/flashgallery.js"></script> 
    <script type="text/javascript">
        jQuery.flashgallery('gallery/gallery.swf', 'gallery/'+config+'.xml', { width: '650px', height: '600px', background: 'transparent' });
    </script>
</body>
</html>

我的CSS是

body {
    width:1020px;
    margin:0 auto;
    position:absolute;
}
aside {
    float:left;
    display:block;
    width:20%;
}
article {
    float:right;
    display:block;
    margin-top:0;
    width:75%;
}
.page_home,
.page_products,
.page_art {
    visibility:hidden;
}
.show {
    visibility: visible;
}
.sidebar {
    margin-left:10px;
}
.nav {
    display:block;
    margin-top:60px;
    list-style-type:none;
}
ul {
    list-style-type:none;
    color:#000;
}
.nav > li {
    background: #666 no-repeat;
    width:150px;
    height:65px;
    color:#000;
}
.nav >li:hover {
    background:#06F no-repeat;
}
.nav > li.active {
    background:#06F no-repeat;
}
.page_products >ul.productcat>li {
    display:inline;
    margin-top:0px;
    float:left;
    list-style-type:none;
    color:#000;
    padding:10px;
}
.page_products >ul.productcat>li:active {
    display:inline;
    margin-top:0px;
    float:left;
    list-style-type:none;
    color:#06F;
}
.page_products >ul.productcat>li:hover {
    display:inline;
    margin-top:0px;
    float:left;
    list-style-type:none;
    color:#06F;
}
4

0 回答 0