我的单页网站出现问题,因为我不希望每个部分的网址都显示出来。不幸的是,命令不起作用,但其他命令,如偏移,速度或缓和,运行良好。怎么会? 这是我的javascript代码。希望有人能提供帮助。 谢谢
$ = jQuery.noConflict();
$(document).ready(function() {
$('ul#menu-main-menu-left li a').each(function() {
$(this).attr('data-scroll','');
});
$('ul#menu-main-menu-right li a').each(function() {
$(this).attr('data-scroll','');
});
smoothScroll.init({
speed: 800,
easing: 'easeInOutCubic',
offset: 33,
updateURL: false,
pagination: true,
responsiveFallback: false,
loop: false
});
var nav = $('.navbar-fixed-top');
var distance = $('.navbar-fixed-top').offset();
if (distance.top >= 20 ) {
nav.addClass('effect');
}
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll >= 20) {
nav.addClass('effect');
} else {
nav.removeClass('effect');
}
});
// When the window has finished loading create our google map below
google.maps.event.addDomListener(window, 'load', init);
function init() {
// Basic options for a simple Google Map
// For more options see: https://developers.google.com/maps/documentation/javascript/reference#MapOptions
var mapOptions = {
// How zoomed in you want the map to start at (always required)
zoom: 11,
// The latitude and longitude to center the map (always required)
center: new google.maps.LatLng(22.248849, 114.167529), // Hong Kong
// How you would like to style the map.
// This is where you would paste any style found on Snazzy Maps.
styles: [{"featureType":"all","elementType":"labels.text.fill","stylers":[{"saturation":36},{"color":"#000000"},{"lightness":40}]},{"featureType":"all","elementType":"labels.text.stroke","stylers":[{"visibility":"on"},{"color":"#000000"},{"lightness":16}]},{"featureType":"all","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"administrative","elementType":"geometry.fill","stylers":[{"color":"#000000"},{"lightness":20}]},{"featureType":"administrative","elementType":"geometry.stroke","stylers":[{"color":"#000000"},{"lightness":17},{"weight":1.2}]},{"featureType":"landscape","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":20}]},{"featureType":"poi","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":21}]},{"featureType":"road.highway","elementType":"geometry.fill","stylers":[{"color":"#000000"},{"lightness":17}]},{"featureType":"road.highway","elementType":"geometry.stroke","stylers":[{"color":"#000000"},{"lightness":29},{"weight":0.2}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":18}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":16}]},{"featureType":"transit","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":19}]},{"featureType":"water","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":17}]}] };
// Get the HTML DOM element that will contain your map
// We are using a div with id="map" seen below in the <body>
var mapElement = document.getElementById('map');
// Create the Google Map using our element and options defined above
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 15,
center: {lat: 22.248849, lng: 114.167529},
disableDefaultUI: true,
scrollwheel: false,
navigationControl: true,
mapTypeControl: false,
scaleControl: true,
draggable: true
});
// Let's also add a marker while we're at it
var marker = new google.maps.Marker({
position: new google.maps.LatLng(22.248849, 114.167529),
map: map,
title: 'Snazzy!'
});
}
});