是否可以在同一个Html中运行两种类型的Jquery函数?

时间:2013-12-18 16:32:46

标签: javascript jquery html

我是一名学生,我正在研究所有我能做的事情,但我已经让两个jquery函数分别正常工作,但是当我尝试在同一个html页面中使用它们时,.pep函数不起作用。我能正确编码吗?

<!DOCTYPE html>
<html><head>
<meta charset="UTF-8">

    <title>Design Fundamentals</title>
    <link href="css/Shapes.css" rel="stylesheet" type="text/css">
    <link href="css/stylesheet.css" rel="stylesheet" type="text/css">



<!-- Load local jQuery.  -->
<script src="jquery.pep.js-master/libs/jquery/jquery.js"></script>
<script src="jquery.pep.js-master/libs/modernizr.min.js"></script>

<!-- Load local lib and tests. -->
<script src="jquery.pep.js-master/src/jquery.pep.js"></script>
<script type="text/javascript">
  $(document).ready(function(){
    $('.square').pep();
    $('.triangle').pep();
    $('.circle').pep();
    <!--$('.peppable2').pep({  constrainTo: 'parent' });-->

  });
</script>

<link type="text/css" rel="stylesheet" href="css/bootstrap-combined.css">
    <link type="text/css" rel="stylesheet" href="css/layout.css">
    <link type="text/css" rel="stylesheet" href="css/jquery_002.css">
    <link type="text/css" rel="stylesheet" href="css/jquery.css" media="all and (min-width: 900px)">
    <link type="text/css" rel="stylesheet" href="css/iconbar.css" media="all and (min-width: 500px) and (max-width: 899px)">

    <script type="text/javascript" src="css/jquery_002.js"></script>
    <script type="text/javascript" src="css/jquery.js"></script>
    <script type="text/javascript">
        $(function() {
            var $menu = $('#menu');

            //  Toggle menu 
            $('#open-icon-menu a').click(function( e ) {
                e.stopImmediatePropagation();
                e.preventDefault();
                $menu.trigger( $menu.hasClass( 'mm-opened' ) ? 'close.mm' : 'open.mm' );                    
            });

            //  Create the menu
            $menu.mmenu({
                onClick: {
                    preventDefault  : true,
                    setSelected     : false
                }
            });

            //  Click an anchor, scroll to section
            $menu
                .find( 'a' )
                .on( 'click',
                    function()
                    {
                        var href = $(this).attr( 'href' );
                        if ( $menu.hasClass( 'mm-opened' ) )
                        {
                            $menu
                                .off( 'closed.mm' )
                                .one( 'closed.mm',
                                    function()
                                    {
                                        setTimeout(
                                            function()
                                            {
                                                $('html, body').animate({
                                                    scrollTop: $( href ).offset().top
                                                });
                                            }, 10
                                        );
                                    }
                                );
                        }
                        else
                        {
                            $('html, body').animate({
                                scrollTop: $( href ).offset().top
                            });
                        }
                    }
                );
        });





    </script>

0 个答案:

没有答案