【问题标题】:style menu didn't slide样式菜单没有滑动
【发布时间】:2012-09-09 14:27:52
【问题描述】:

我正在尝试制作这个style meny

我正在使用这个guide 来制作 html 文件 - 只需将它放在一个文件中

问题在于它不是滑动的。

Html 代码 - 我不认为 html 代码有错误:

<ul>
        <li class="green" id="dropper">
            <p><a href="#">Home</a></p>
            <p class="subtext">The front page</p>
        </li>
        <li class="yellow" id="dropper">
            <p><a href="#">About</a></p>
            <p class="subtext">More info</p>
        </li>
        <li class="red" id="dropper">
            <p><a href="#">Contact</a></p>
            <p class="subtext">Get in touch</p>
        </li>
        <li class="blue" id="dropper">
            <p><a href="#">Submit</a></p>
            <p class="subtext">Send us your stuff!</p>
        </li>
        <li class="purple" id="dropper">
            <p><a href="#">Terms</a></p>
            <p class="subtext">Legal things</p>
        </li>
    </ul>

Jquery 代码 - 问题可能在这里:

    $(document).ready(function(){
        //Remove outline from links
        $("a").click(function(){
            $(this).blur();
        });

        //When mouse rolls over
        $("#dropper").mouseover(function(){
            $(this).stop().animate({height:'300px'},{queue:false, duration:600, easing: 'easeOutBounce'})
        });

        //When mouse is removed
        $("#dropper").mouseout(function(){
            $(this).stop().animate({height:'50px'},{queue:false, duration:600, easing: 'easeOutBounce'})
        });

CSS 代码 - 问题可能在这里:

       body{
    font-family:"Lucida Grande", arial, sans-serif;
    background:#F3F3F3;
}

ul{
    margin:0;
    padding:0;
}

li{
    width:100px;
    height:50px;
    float:left;
    color:#191919;
    text-align:center;
    overflow:hidden;
}

a{
    color:#FFF;
    text-decoration:none;
}

p{
    padding:0px 5px;
}

    .subtext{
        padding-top:15px;
    }

/*Menu Color Classes*/
.green{background:#6AA63B url('http://buildinternet.com/live/smoothmenu/images/green-item-bg.jpg') top left no-repeat;}
.yellow{background:#FBC700 url('http://buildinternet.com/live/smoothmenu/images/yellow-item-bg.jpg') top left no-repeat;}
.red{background:#D52100 url('http://buildinternet.com/live/smoothmenu/images/red-item-bg.jpg') top left no-repeat;}
.purple{background:#5122B4 url('http://buildinternet.com/live/smoothmenu/images/purple-item-bg.jpg') top left no-repeat;}
.blue{background:#0292C0 url('http://buildinternet.com/live/smoothmenu/images/blue-item-bg.jpg') top left no-repeat;}

【问题讨论】:

  • 大家好,我像他一样复制那里的源代码(css 文件和查询文件是指向那里的站点的链接)并且此代码有效!你能让我的代码不需要从其他页面获取脚本就可以工作吗,包括 jquery 代码和 css 并且可以工作?

标签: jquery html css menu


【解决方案1】:

您必须删除相同的 id(该 id 是唯一值),就像 Kuro 说的

但另一个错误是缺少“});”输入结束。

而这部分代码,是你可以删除添加一些 CSS(如边框:0;)

$("a").click(function(){
    $(this).blur();
});

您正在使用 Hosting24,他们在所有页面中创建了一个脚本...
删除它看看这个问题Webhoster inserts a javascript which brokes my code how to remove it?
希望对您有所帮助。

【讨论】:

  • "但另一个错误是缺少"});"输入结束。"我复制到这里的内容有错误 - 忘记复制这个});我应该删除 $("a").click(function(){ $(this).blur(); }); ?
  • @user1515823 blur 部分无关紧要。 @Guilherme 只是指出您可以使用 CSS 来代替。我建议你暂时保留它。
  • 删除动画的“, easing: 'easeOutBounce'”
  • @Guilherme 说真的,这真的不是问题。
  • 我尝试保存您的页面,但在我看来,您的底部有一个返回错误的脚本,请尝试将其删除 - 并且可以使用 teste.gschutz.com/checking.htm
猜你喜欢
  • 2012-10-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-09-17
  • 2012-09-05
  • 1970-01-01
  • 2018-01-28
相关资源
最近更新 更多