修改相關

This commit is contained in:
2018-10-28 20:53:08 +08:00
parent 2c37287d94
commit d16a2fabcf
7 changed files with 391 additions and 398 deletions

View File

@@ -4,10 +4,14 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>上海丙维科技有限公司</title>
</head>
<body>
<div id="app"></div>
</body>
</html>

View File

@@ -1,5 +1,6 @@
var isMobile = isMobileWidth();
var isPhone = isPhoneWidth();
var isMobile = null;
var isPhone = null;
var wasMobile = isMobile;
var wasDesktop = !isMobile;
@@ -8,15 +9,19 @@ var isMiniHeader = false;
var myLocationLat = null;
var myLocationLong = null;
$(document).ready(function() {
initListeners();
initHeader();
initForms();
initMobileMenu();
adjustElementsForScreen();
class Common {
constructor(name, age) {
this.name = name;
this.age = age;
}
});
init() {
var self=this;
isMobile = common.isMobileWidth();
isPhone = common.isPhoneWidth();
//create trigger to resizeEnd event, called after event is finished
$(window).resize(function () {
@@ -29,13 +34,13 @@ $(window).resize(function() {
//cdetermine scren type and call style functions after window resize is completed
$(window).on('resizeEnd', function () {
adjustElementsForScreen();
self.adjustElementsForScreen();
});
$(window).scroll(function () {
if ($(window).scrollTop() > 200) {
if(isMiniHeader === false && !isMobileWidth()) {
if (isMiniHeader === false && !self.isMobileWidth()) {
$('.header').addClass('mini');
isMiniHeader = true;
}
@@ -50,12 +55,28 @@ $(window).scroll(function() {
});
function adjustElementsForScreen() {
isMobile = isMobileWidth();
isPhone = isPhoneWidth();
$.scrollToElement = function ($element) {
if (!isMobileWidth()) {
var adjustment = 0;
if (isMiniHeader) {
adjustment = 35;
}
var $header = $('.header:first');
$('html,body').animate({ scrollTop: $element.offset().top - ($header.length > 0 ? $header.height() : 0) - adjustment }, 'slow');
};
}
adjustElementsForScreen() {
isMobile = this.isMobileWidth();
isPhone = this.isPhoneWidth();
if (!this.isMobileWidth()) {
$(".mobileContent").hide();
}
@@ -85,11 +106,13 @@ function adjustElementsForScreen() {
$(".findUsNorway").attr("href", "https://www.google.com/maps/dir//Skogliveien+4a,+3047+Drammen,+Norway");
}
adjustContentBannersForScreen();
this.adjustContentBannersForScreen();
}
function initHeader() {
initHeader() {
//go to main page if not there on logo click
$(".logoCell .logo").on("click", function () {
@@ -114,12 +137,12 @@ function initHeader() {
$("table.mainMenu > tbody > tr > td.selected").css("box-shadow", "0 -3px 0 #ff0000 inset");
});
highlightHeaderCategory();
this.highlightHeaderCategory();
}
//highlight the appproprate main header meny category by examing url
function highlightHeaderCategory() {
highlightHeaderCategory() {
var myLocation = location.pathname;
@@ -150,9 +173,7 @@ function highlightHeaderCategory() {
}
}
//event listners for elements
function initListeners() {
initListeners() {
$("#hamburger").on("click", function () {
@@ -183,6 +204,7 @@ function initListeners() {
});
$("#screenOverlayBehindHeader, .linkGoBack").on("click", function (e) {
if ($("#mobileMenu").hasClass("showing")) {
hideMobileMenu();
@@ -218,15 +240,9 @@ function initListeners() {
$(this).parent().remove();
});
//location
/*$("#ourLocationSweden").on("click", function(e) {
e.preventDefault();
navigateTo("sweden", $(this));
});*/
}
function initMobileMenu() {
initMobileMenu() {
$("#mobileMenu a").on("click", function (e) {
if ($(this).hasClass("hasSubmenu")) {
@@ -244,7 +260,7 @@ function initMobileMenu() {
}
function initForms() {
initForms() {
$(".btnQuitForm").on("click", function () {
@@ -266,7 +282,7 @@ function initForms() {
}
function showForm(formName) {
showForm(formName) {
$("#forms").show();
$("#screenOverlay").show();
@@ -294,7 +310,7 @@ function showForm(formName) {
}
function submitSupportForm(form) {
submitSupportForm(form) {
$.post("http://biz199.inmotionhosting.com/~rustyt6/pythagoras/php/submit_support_form.php",
{
@@ -324,7 +340,8 @@ function submitSupportForm(form) {
$("#supComments").val("");
}
function submitContactForm(form) {
submitContactForm(form) {
$.post("http://biz199.inmotionhosting.com/~rustyt6/pythagoras/php/submit_contact_form.php",
{
@@ -349,9 +366,9 @@ function submitContactForm(form) {
}
function adjustContentBannersForScreen() {
adjustContentBannersForScreen() {
if (isMobileWidth()) {
if (this.isMobileWidth()) {
$("#pageBannerImage1").attr("src", "images/banner_page_mobile_solutions_mobile.jpg");
$("#pageBannerImage2").attr("src", "images/banner_page_ifrs16_mobile.jpg");
$("#pageBannerImage3").attr("src", "images/banner_page_gdpr_mobile.jpg");
@@ -362,86 +379,49 @@ function adjustContentBannersForScreen() {
}
}
/*function navigateTo(destination, $element) {
var baseAddress = "https://www.google.com/maps/dir/";
var addressSweden = "Pythagoras+AB,+S%C3%B6der+M%C3%A4larstrand+27+B,+118+25+Stockholm";
if (myLocationLat == null || myLocationLong == null) {
getUserLocationForDirections();
}else{
if ($element.attr("href").length <= 1) {
$element.attr("href", baseAddress + myLocationLat + "," + myLocationLong + "/" + addressSweden);
}
console.log($element.attr("href"));
}
}
function getUserLocationForDirections() {
$.post("https://www.googleapis.com/geolocation/v1/geolocate?key=AIzaSyB04D7_YYzWb3y3TDtVr-FR3rkBHSV6oOg",
function(data){
console.log(data);
myLocationLat = data.location.lat;
myLocationLong = data.location.lng;
console.log(myLocationLat, myLocationLong);
//setupDirections();
//https://www.google.com/maps/dir/?api=1&destination=Pythagoras+AB,+S%C3%B6der+M%C3%A4larstrand+27+B,+118+25+Stockholm
});
}*/
function showMobileMenu() {
showMobileMenu() {
$("#screenOverlayBehindHeader").show();
$("#mobileMenu").slideDown();
$("#mobileMenu").addClass("showing");
}
function hideMobileMenu() {
hideMobileMenu() {
$("#mobileMenu").slideUp(function () {
$("#screenOverlayBehindHeader").hide();
});
$("#mobileMenu").removeClass("showing");
}
function showMobileLanguageMenu() {
showMobileLanguageMenu() {
$("#screenOverlayBehindHeader").show();
$("#mobileLanguageMenu").slideDown();
$("#mobileLanguageMenu").addClass("showing");
}
function hideMobileLanguageMenu() {
hideMobileLanguageMenu() {
$("#mobileLanguageMenu").slideUp(function () {
$("#screenOverlayBehindHeader").hide();
});
$("#mobileLanguageMenu").removeClass("showing");
}
$.scrollToElement = function($element){
var adjustment = 0;
if (isMiniHeader) {
adjustment = 35;
}
var $header = $('.header:first');
$('html,body').animate({scrollTop: $element.offset().top-($header.length > 0 ? $header.height() : 0) - adjustment}, 'slow');
};
//scroll page to top
function scrollToTop() {
scrollToTop() {
$("body,html").animate({ scrollTop: 0 }, "slow");
}
//is screen mobile? (<= 768 px)
//#mobile_indicator is show/hidden via media query
function isMobileWidth() {
isMobileWidth() {
return $('#mobile_indicator').is(':visible');
}
//is screen phone? (<= 480 px)
//#mobile_indicator is show/hidden via media query
function isPhoneWidth() {
isPhoneWidth() {
return $('#phone_indicator').is(':visible');
}
}
export const common = new Common();

View File

@@ -87,11 +87,21 @@
</div>
</template>
<script>
import { common } from "../assets/static/common";
export default {
data() {
return {
menus: window.config.menus
};
},
mounted: function() {
common.init();
common.initListeners();
common.initHeader();
common.initForms();
common.initMobileMenu();
common.adjustElementsForScreen();
}
};
</script>

View File

@@ -4,6 +4,7 @@ import 'swiper/dist/css/swiper.css'
import './assets/static/config.js'
import './assets/static/jquery.js'
import './assets/static/common.js'
import 'es6-promise/auto'

View File

@@ -110,10 +110,10 @@ export default {
methods: {
onSlideChangeStart(currentPage) {
console.log("onSlideChangeStart", currentPage);
},
onSlideChangeEnd(currentPage) {
console.log("onSlideChangeEnd", currentPage);
}
}
};

View File

@@ -10,7 +10,6 @@
</div>
<ifooter></ifooter>
</div>
</template>
<script>

View File

@@ -10,7 +10,6 @@
</div>
<ifooter></ifooter>
</div>
</template>
<script>