导入JQuery响应Navbar不起作用

时间:2018-05-07 12:08:26

标签: php jquery html twitter-bootstrap

我正在尝试使导航栏响应但它不起作用。我正在使用谷歌的JQuery,但由于我目前在中国,它不起作用。所以我将JQuery文件的内容复制到一个名为jquery-3.3.1.min.js的文件中,该文件存储在我的Header文件的同一目录中。

它仍然无法通过手机打开。我在下面附上代码:

<head>
 <script src="jquery-3.3.1.min.js"></script>
 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
 <title>International Corporate Finance</title>
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
 <link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet" type="text/css">
 <link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet" type="text/css">
</head>

<!-- NAVBAR --> 
<body id="myPage" data-spy="scroll" data-target=".navbar" data-offset="60">

<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
  <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span> 
  </button>
  <a class="navbar-brand" href="#myPage">Pippo</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
  <ul class="nav navbar-nav navbar-right">
    <li><a href="http://ec2-13-133-18-154.aws.com/Actions.php">Actions</a></li>
    <li><a href="http://ec2-13-133-18-154.aws.com/Actions.php/CompaniesInput.php">New Companies</a></li>
    <li><a href="http://ec2-13-133-18-154.aws.com/Actions.php/AllCompanies.php">View Companies</a></li>
    <li><a href="http://ec2-13-133-18-154.aws.com/Actions.php/Search.php">Search Companies</a></li>
    <li><a href="http://ec2-13-133-18-154.aws.com/">CONTACT</a></li>
  </ul>
</div>

2 个答案:

答案 0 :(得分:0)

看起来你的路径错了。确保您的jquery.min.js文件是正确的路径。如果您可以发布文件夹结构的图片,如果您遇到问题,我们将很乐意为您提供帮助。另外,另一种解决方案是使用cdn代替。示例:<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

答案 1 :(得分:0)

我使用Microsoft CDN解决了这个问题

mGoogleApiClient = new GoogleApiClient.Builder(this)
                .addConnectionCallbacks(this)
                .addOnConnectionFailedListener(this)
                .addApi(LocationServices.API)
                .build();
        mLocationRequest = new LocationRequest();
        mLocationRequest.setInterval(UPDATE_INTERVAL_IN_MILLISECONDS);
        mLocationRequest.setFastestInterval(FASTEST_UPDATE_INTERVAL_IN_MILLISECONDS);
        mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
        LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder();
        builder.addLocationRequest(mLocationRequest);
        builder.setAlwaysShow(true);
        mLocationSettingsRequest = builder.build();

        PendingResult<LocationSettingsResult> result =
                LocationServices.SettingsApi.checkLocationSettings(
                        mGoogleApiClient,
                        mLocationSettingsRequest
                );
        result.setResultCallback(this);