一个jquery函数禁用另一个

时间:2014-03-06 07:35:24

标签: javascript jquery

<!DOCTYPE html>
<!--  



-->
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
<!-- BEGIN HEAD -->
<head>

    <meta charset="utf-8" />
    <title>F.E.G | Admin Dashboard </title>
    <meta content="width=device-width, initial-scale=1.0" name="viewport" />
    <!-- BEGIN GLOBAL MANDATORY STYLES -->

    <script src="js/text_class.js" type="text/javascript"></script>
    <script src="web/assets/plugins/flot/jquery.flot.js" type="text/javascript"></script>
    <script type="text/javascript" src="/js/bmain172.js"></script>
    <script src="/js/text_class.js" type="text/javascript"></script>
    <script src="/freedomtextim/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script src="/freedomtextim/jquery-ui.js"></script>
    <link href="freedomtextim/assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="web/assets/plugins/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" />
    <link href="freedomtextim/assets/plugins/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <link href="freedomtextim/assets/css/style.css" rel="stylesheet" />
    <link href="web/assets/css/style-responsive.css" rel="stylesheet" />
    <link href="web/assets/css/themes/default.css" rel="stylesheet" id="style_color" />
    <link href="web/assets/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css" />
    <link href="#" rel="stylesheet" id="style_metro" />
    <!-- END GLOBAL MANDATORY STYLES -->
    <!-- BEGIN PAGE LEVEL STYLES -->    
    <link href="web/assets/plugins/fancybox/source/jquery.fancybox.css" rel="stylesheet" rel="stylesheet" type="text/css" />

    <link href="web/assets/plugins/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet" type="text/css" />
    <link href="web/assets/plugins/fullcalendar/fullcalendar/bootstrap-fullcalendar.css" rel="stylesheet" type="text/css"  />
    <link href="web/assets/plugins/jqvmap/jqvmap/jqvmap.css" media="screen" rel="stylesheet" type="text/css" />
    <!-- END PAGE LEVEL STYLES -->

    <link href="/freedomtextim/jquery-ui.css" rel="stylesheet" type="text/css">

<script>$(function () {
    $(document).tooltip({
        position: { my: "left+15 center", at: "right center"},
        content: function () {
            return $(this).prop('title');
        },
        show: null, 
        close: function (event, ui) {
            ui.tooltip.hover(

            function () {
                $(this).stop(true).fadeTo(400, 1);
            },

            function () {
                $(this).fadeOut("400", function () {
                    $(this).remove();
                })
            });
        }
    });
}); </script>

<script src="web/assets/plugins/jquery-1.8.3.min.js" type="text/javascript"></script>   
    <!-- IMPORTANT! Load jquery-ui-1.10.1.custom.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->    
    <script src="web/assets/plugins/breakpoints/breakpoints.js" type="text/javascript"></script>
    <script src="web/assets/scripts/app.js" type="text/javascript"></script>

<script>
        jQuery(document).ready(function() {     
            App.init(); // initlayout and core plugins
            Index.init();
            Index.initJQVMAP(); // init index page's custom scripts
            Index.initKnowElements(); // init circle stats(knob elements)
            Index.initPeityElements(); // init pierty elements
            Index.initCalendar(); // init index page's custom scripts
            Index.initCharts(); // init index page's custom scripts
            Index.initChat();
            Index.initDashboardDaterange();
            Index.initIntro();
        });
    </script>

<style type="text/css">
  label {
          display: inline-block;
          width: 5em;
      }
      .red {
          color: red;
      }
    }</style>

</head>

在app.js文件中。

var handleSidebarMenu = function () {

        jQuery('#sidebar .has-sub > a').click(function (e) {
            var last = jQuery('.has-sub.open', $('#sidebar'));
            last.removeClass("open");
            jQuery('.arrow', last).removeClass("open");
            jQuery('.sub', last).slideUp(200);
            var sub = jQuery(this).next();
            if (sub.is(":visible")) {
                jQuery('.arrow', jQuery(this)).removeClass("open");
                jQuery(this).parent().removeClass("open");
                sub.slideUp(200, function () {
                    handleSidebarAndContentHeight(); 
                });
            } else {
                jQuery('.arrow', jQuery(this)).addClass("open");
                jQuery(this).parent().addClass("open");
                sub.slideDown(200, function () {
                    handleSidebarAndContentHeight(); 
                });
            }
            e.preventDefault();
        });
    }

enter image description here

1 个答案:

答案 0 :(得分:5)

在你包含jQuery之后你需要把你的jQuery代码。

<script src="web/assets/plugins/jquery-1.8.3.min.js" type="text/javascript"></script>   
<!-- IMPORTANT! Load jquery-ui-1.10.1.custom.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->    
<script src="web/assets/plugins/breakpoints/breakpoints.js" type="text/javascript"></script>    
<script src="web/assets/scripts/app.js" type="text/javascript"></script>
<script>
    // Your code here
</script>