update,
This commit is contained in:
48
dreamtech.hk/mtHK.github.io-main/js/ajax-form.js
Normal file
48
dreamtech.hk/mtHK.github.io-main/js/ajax-form.js
Normal file
@@ -0,0 +1,48 @@
|
||||
$(function() {
|
||||
|
||||
// Get the form.
|
||||
var form = $('#contact-form');
|
||||
|
||||
// Get the messages div.
|
||||
var formMessages = $('.ajax-response');
|
||||
|
||||
// Set up an event listener for the contact form.
|
||||
$(form).submit(function(e) {
|
||||
// Stop the browser from submitting the form.
|
||||
e.preventDefault();
|
||||
|
||||
// Serialize the form data.
|
||||
var formData = $(form).serialize();
|
||||
|
||||
// Submit the form using AJAX.
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: $(form).attr('action'),
|
||||
data: formData
|
||||
})
|
||||
.done(function(response) {
|
||||
// Make sure that the formMessages div has the 'success' class.
|
||||
$(formMessages).removeClass('error');
|
||||
$(formMessages).addClass('success');
|
||||
|
||||
// Set the message text.
|
||||
$(formMessages).text(response);
|
||||
|
||||
// Clear the form.
|
||||
$('#contact-form input,#contact-form textarea').val('');
|
||||
})
|
||||
.fail(function(data) {
|
||||
// Make sure that the formMessages div has the 'error' class.
|
||||
$(formMessages).removeClass('success');
|
||||
$(formMessages).addClass('error');
|
||||
|
||||
// Set the message text.
|
||||
if (data.responseText !== '') {
|
||||
$(formMessages).text(data.responseText);
|
||||
} else {
|
||||
$(formMessages).text('Oops! An error occured and your message could not be sent.');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
8
dreamtech.hk/mtHK.github.io-main/js/bootstrap.min.js
vendored
Normal file
8
dreamtech.hk/mtHK.github.io-main/js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
42
dreamtech.hk/mtHK.github.io-main/js/element-in-view.js
Normal file
42
dreamtech.hk/mtHK.github.io-main/js/element-in-view.js
Normal file
@@ -0,0 +1,42 @@
|
||||
(function($) {
|
||||
|
||||
/**
|
||||
* Copyright 2012, Digital Fusion
|
||||
* Licensed under the MIT license.
|
||||
* http://teamdf.com/jquery-plugins/license/
|
||||
*
|
||||
* @author Sam Sehnert
|
||||
* @desc A small plugin that checks whether elements are within
|
||||
* the user visible viewport of a web browser.
|
||||
* only accounts for vertical position, not horizontal.
|
||||
*/
|
||||
|
||||
$.fn.visible = function(partial) {
|
||||
|
||||
var $t = $(this),
|
||||
$w = $(window),
|
||||
viewTop = $w.scrollTop(),
|
||||
viewBottom = viewTop + $w.height(),
|
||||
_top = $t.offset().top,
|
||||
_bottom = _top + $t.height(),
|
||||
compareTop = partial === true ? _bottom : _top,
|
||||
compareBottom = partial === true ? _top : _bottom;
|
||||
|
||||
return ((compareBottom <= viewBottom) && (compareTop >= viewTop));
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
||||
$(window).on('scroll', function() {
|
||||
|
||||
$(".testimonial-author .author-one, .testimonial-author .author-two, .testimonial-author .author-three, .testimonial-author .author-four, .testimonial-author .author-five, .testimonial-avatar .avatar-one, .testimonial-avatar .avatar-two, .testimonial-avatar .avatar-three, .testimonial-avatar .avatar-four, .testimonial-avatar .avatar-five, .testimonial-avatar .avatar-six").each(function(i, el) {
|
||||
var el = $(el);
|
||||
if (el.visible(true)) {
|
||||
el.addClass("now-in-view");
|
||||
} else {
|
||||
el.removeClass("now-in-view");
|
||||
}
|
||||
});
|
||||
|
||||
});
|
7
dreamtech.hk/mtHK.github.io-main/js/imagesloaded.pkgd.min.js
vendored
Normal file
7
dreamtech.hk/mtHK.github.io-main/js/imagesloaded.pkgd.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
12
dreamtech.hk/mtHK.github.io-main/js/isotope.pkgd.min.js
vendored
Normal file
12
dreamtech.hk/mtHK.github.io-main/js/isotope.pkgd.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
262
dreamtech.hk/mtHK.github.io-main/js/jquery.countdown.min.js
vendored
Normal file
262
dreamtech.hk/mtHK.github.io-main/js/jquery.countdown.min.js
vendored
Normal file
@@ -0,0 +1,262 @@
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
// AMD. Register as anonymous module.
|
||||
define(["jquery"], factory);
|
||||
} else {
|
||||
// Browser globals.
|
||||
factory(jQuery);
|
||||
}
|
||||
})(function ($) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var Countdown = function (element, options) {
|
||||
this.$element = $(element);
|
||||
this.defaults = $.extend({}, Countdown.defaults, this.$element.data(), $.isPlainObject(options) ? options : {});
|
||||
this.init();
|
||||
};
|
||||
|
||||
Countdown.prototype = {
|
||||
constructor: Countdown,
|
||||
|
||||
init: function () {
|
||||
var content = this.$element.html(),
|
||||
date = new Date(this.defaults.date || content);
|
||||
|
||||
if (date.getTime()) {
|
||||
this.content = content;
|
||||
this.date = date;
|
||||
this.find();
|
||||
|
||||
if (this.defaults.autoStart) {
|
||||
this.start();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
find: function () {
|
||||
var $element = this.$element;
|
||||
|
||||
this.$days = $element.find("[data-days]");
|
||||
this.$hours = $element.find("[data-hours]");
|
||||
this.$minutes = $element.find("[data-minutes]");
|
||||
this.$seconds = $element.find("[data-seconds]");
|
||||
|
||||
if ((this.$days.length + this.$hours.length + this.$minutes.length + this.$seconds.length) > 0) {
|
||||
this.found = true;
|
||||
}
|
||||
},
|
||||
|
||||
reset: function () {
|
||||
if (this.found) {
|
||||
this.output("days");
|
||||
this.output("hours");
|
||||
this.output("minutes");
|
||||
this.output("seconds");
|
||||
} else {
|
||||
this.output();
|
||||
}
|
||||
},
|
||||
|
||||
ready: function () {
|
||||
var date = this.date,
|
||||
decisecond = 100,
|
||||
second = 1000,
|
||||
minute = 60000,
|
||||
hour = 3600000,
|
||||
day = 86400000,
|
||||
remainder = {},
|
||||
diff;
|
||||
|
||||
if (!date) {
|
||||
return false;
|
||||
}
|
||||
|
||||
diff = date.getTime() - (new Date()).getTime();
|
||||
|
||||
if (diff <= 0) {
|
||||
this.end();
|
||||
return false;
|
||||
}
|
||||
|
||||
remainder.days = diff;
|
||||
remainder.hours = remainder.days % day;
|
||||
remainder.minutes = remainder.hours % hour;
|
||||
remainder.seconds = remainder.minutes % minute;
|
||||
remainder.milliseconds = remainder.seconds % second;
|
||||
|
||||
this.days = Math.floor(remainder.days / day);
|
||||
this.hours = Math.floor(remainder.hours / hour);
|
||||
this.minutes = Math.floor(remainder.minutes / minute);
|
||||
this.seconds = Math.floor(remainder.seconds / second);
|
||||
this.deciseconds = Math.floor(remainder.milliseconds / decisecond);
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
start: function () {
|
||||
if (!this.active && this.ready()) {
|
||||
this.active = true;
|
||||
this.reset();
|
||||
this.autoUpdate = this.defaults.fast ?
|
||||
setInterval($.proxy(this.fastUpdate, this), 100) :
|
||||
setInterval($.proxy(this.update, this), 1000);
|
||||
}
|
||||
},
|
||||
|
||||
stop: function () {
|
||||
if (this.active) {
|
||||
this.active = false;
|
||||
clearInterval(this.autoUpdate);
|
||||
}
|
||||
},
|
||||
|
||||
end: function () {
|
||||
if (!this.date) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.stop();
|
||||
|
||||
this.days = 0;
|
||||
this.hours = 0;
|
||||
this.minutes = 0;
|
||||
this.seconds = 0;
|
||||
this.deciseconds = 0;
|
||||
this.reset();
|
||||
this.defaults.end();
|
||||
},
|
||||
|
||||
destroy: function () {
|
||||
if (!this.date) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.stop();
|
||||
|
||||
this.$days = null;
|
||||
this.$hours = null;
|
||||
this.$minutes = null;
|
||||
this.$seconds = null;
|
||||
|
||||
this.$element.empty().html(this.content);
|
||||
this.$element.removeData("countdown");
|
||||
},
|
||||
|
||||
fastUpdate: function () {
|
||||
if (--this.deciseconds >= 0) {
|
||||
this.output("deciseconds");
|
||||
} else {
|
||||
this.deciseconds = 9;
|
||||
this.update();
|
||||
}
|
||||
},
|
||||
|
||||
update: function () {
|
||||
if (--this.seconds >= 0) {
|
||||
this.output("seconds");
|
||||
} else {
|
||||
this.seconds = 59;
|
||||
|
||||
if (--this.minutes >= 0) {
|
||||
this.output("minutes");
|
||||
} else {
|
||||
this.minutes = 59;
|
||||
|
||||
if (--this.hours >= 0) {
|
||||
this.output("hours");
|
||||
} else {
|
||||
this.hours = 23;
|
||||
|
||||
if (--this.days >= 0) {
|
||||
this.output("days");
|
||||
} else {
|
||||
this.end();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
output: function (type) {
|
||||
if (!this.found) {
|
||||
this.$element.empty().html(this.template());
|
||||
return;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case "deciseconds":
|
||||
this.$seconds.text(this.getSecondsText());
|
||||
break;
|
||||
|
||||
case "seconds":
|
||||
this.$seconds.text(this.seconds);
|
||||
break;
|
||||
|
||||
case "minutes":
|
||||
this.$minutes.text(this.minutes);
|
||||
break;
|
||||
|
||||
case "hours":
|
||||
this.$hours.text(this.hours);
|
||||
break;
|
||||
|
||||
case "days":
|
||||
this.$days.text(this.days);
|
||||
break;
|
||||
|
||||
// No default
|
||||
}
|
||||
},
|
||||
|
||||
template: function () {
|
||||
return this.defaults.text
|
||||
.replace("%s", this.days)
|
||||
.replace("%s", this.hours)
|
||||
.replace("%s", this.minutes)
|
||||
.replace("%s", this.getSecondsText());
|
||||
},
|
||||
|
||||
getSecondsText: function () {
|
||||
return this.active && this.defaults.fast ? (this.seconds + "." + this.deciseconds) : this.seconds;
|
||||
}
|
||||
};
|
||||
|
||||
// Default settings
|
||||
Countdown.defaults = {
|
||||
autoStart: true,
|
||||
date: null,
|
||||
fast: false,
|
||||
end: $.noop,
|
||||
text: "%s days, %s hours, %s minutes, %s seconds"
|
||||
};
|
||||
|
||||
// Set default settings
|
||||
Countdown.setDefaults = function (options) {
|
||||
$.extend(Countdown.defaults, options);
|
||||
};
|
||||
|
||||
// Register as jQuery plugin
|
||||
$.fn.countdown = function (options) {
|
||||
return this.each(function () {
|
||||
var $this = $(this),
|
||||
data = $this.data("countdown");
|
||||
|
||||
if (!data) {
|
||||
$this.data("countdown", (data = new Countdown(this, options)));
|
||||
}
|
||||
|
||||
if (typeof options === "string" && $.isFunction(data[options])) {
|
||||
data[options]();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.countdown.constructor = Countdown;
|
||||
$.fn.countdown.setDefaults = Countdown.setDefaults;
|
||||
|
||||
$(function () {
|
||||
$("[countdown]").countdown();
|
||||
});
|
||||
|
||||
});
|
8
dreamtech.hk/mtHK.github.io-main/js/jquery.counterup.min.js
vendored
Normal file
8
dreamtech.hk/mtHK.github.io-main/js/jquery.counterup.min.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/*!
|
||||
* jquery.counterup.js 1.0
|
||||
*
|
||||
* Copyright 2013, Benjamin Intal http://gambit.ph @bfintal
|
||||
* Released under the GPL v2 License
|
||||
*
|
||||
* Date: Nov 26, 2013
|
||||
*/(function(e){"use strict";e.fn.counterUp=function(t){var n=e.extend({time:400,delay:10},t);return this.each(function(){var t=e(this),r=n,i=function(){var e=[],n=r.time/r.delay,i=t.text(),s=/[0-9]+,[0-9]+/.test(i);i=i.replace(/,/g,"");var o=/^[0-9]+$/.test(i),u=/^[0-9]+\.[0-9]+$/.test(i),a=u?(i.split(".")[1]||[]).length:0;for(var f=n;f>=1;f--){var l=parseInt(i/n*f);u&&(l=parseFloat(i/n*f).toFixed(a));if(s)while(/(\d+)(\d{3})/.test(l.toString()))l=l.toString().replace(/(\d+)(\d{3})/,"$1,$2");e.unshift(l)}t.data("counterup-nums",e);t.text("0");var c=function(){t.text(t.data("counterup-nums").shift());if(t.data("counterup-nums").length)setTimeout(t.data("counterup-func"),r.delay);else{delete t.data("counterup-nums");t.data("counterup-nums",null);t.data("counterup-func",null)}};t.data("counterup-func",c);setTimeout(t.data("counterup-func"),r.delay)};t.waypoint(i,{offset:"100%",triggerOnce:!0})})}})(jQuery);
|
4
dreamtech.hk/mtHK.github.io-main/js/jquery.magnific-popup.min.js
vendored
Normal file
4
dreamtech.hk/mtHK.github.io-main/js/jquery.magnific-popup.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
7
dreamtech.hk/mtHK.github.io-main/js/jquery.scrollUp.min.js
vendored
Normal file
7
dreamtech.hk/mtHK.github.io-main/js/jquery.scrollUp.min.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/*!
|
||||
* scrollup v2.4.1
|
||||
* Url: http://markgoodyear.com/labs/scrollup/
|
||||
* Copyright (c) Mark Goodyear — @markgdyr — http://markgoodyear.com
|
||||
* License: MIT
|
||||
*/
|
||||
!function(l,o,e){"use strict";l.fn.scrollUp=function(o){l.data(e.body,"scrollUp")||(l.data(e.body,"scrollUp",!0),l.fn.scrollUp.init(o))},l.fn.scrollUp.init=function(r){var s,t,c,i,n,a,d,p=l.fn.scrollUp.settings=l.extend({},l.fn.scrollUp.defaults,r),f=!1;switch(d=p.scrollTrigger?l(p.scrollTrigger):l("<a/>",{id:p.scrollName,href:"#top"}),p.scrollTitle&&d.attr("title",p.scrollTitle),d.appendTo("body"),p.scrollImg||p.scrollTrigger||d.html(p.scrollText),d.css({display:"none",position:"fixed",zIndex:p.zIndex}),p.activeOverlay&&l("<div/>",{id:p.scrollName+"-active"}).css({position:"absolute",top:p.scrollDistance+"px",width:"100%",borderTop:"1px dotted"+p.activeOverlay,zIndex:p.zIndex}).appendTo("body"),p.animation){case"fade":s="fadeIn",t="fadeOut",c=p.animationSpeed;break;case"slide":s="slideDown",t="slideUp",c=p.animationSpeed;break;default:s="show",t="hide",c=0}i="top"===p.scrollFrom?p.scrollDistance:l(e).height()-l(o).height()-p.scrollDistance,n=l(o).scroll(function(){l(o).scrollTop()>i?f||(d[s](c),f=!0):f&&(d[t](c),f=!1)}),p.scrollTarget?"number"==typeof p.scrollTarget?a=p.scrollTarget:"string"==typeof p.scrollTarget&&(a=Math.floor(l(p.scrollTarget).offset().top)):a=0,d.click(function(o){o.preventDefault(),l("html, body").animate({scrollTop:a},p.scrollSpeed,p.easingType)})},l.fn.scrollUp.defaults={scrollName:"scrollUp",scrollDistance:300,scrollFrom:"top",scrollSpeed:300,easingType:"linear",animation:"fade",animationSpeed:200,scrollTrigger:!1,scrollTarget:!1,scrollText:"Scroll to top",scrollTitle:!1,scrollImg:!1,activeOverlay:!1,zIndex:2147483647},l.fn.scrollUp.destroy=function(r){l.removeData(e.body,"scrollUp"),l("#"+l.fn.scrollUp.settings.scrollName).remove(),l("#"+l.fn.scrollUp.settings.scrollName+"-active").remove(),l.fn.jquery.split(".")[1]>=7?l(o).off("scroll",r):l(o).unbind("scroll",r)},l.scrollUp=l.fn.scrollUp}(jQuery,window,document);
|
8
dreamtech.hk/mtHK.github.io-main/js/jquery.waypoints.min.js
vendored
Normal file
8
dreamtech.hk/mtHK.github.io-main/js/jquery.waypoints.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
325
dreamtech.hk/mtHK.github.io-main/js/main.js
Normal file
325
dreamtech.hk/mtHK.github.io-main/js/main.js
Normal file
@@ -0,0 +1,325 @@
|
||||
(function ($) {
|
||||
"use strict";
|
||||
//<2F><><EFBFBD>ࣺhttp://www.bootstrapmb.com
|
||||
//masonry
|
||||
$('#container').imagesLoaded( function() {
|
||||
$('.grid').isotope({
|
||||
itemSelector: '.grid-item',
|
||||
percentPosition: true,
|
||||
masonry: {
|
||||
// use outer width of grid-sizer for columnWidth
|
||||
columnWidth: '.grid-item'
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
// One Page Nav
|
||||
var top_offset = $('.header-area').height() - 100;
|
||||
$('.main-menu nav ul').onePageNav({
|
||||
currentClass: 'active',
|
||||
scrollOffset: top_offset,
|
||||
});
|
||||
|
||||
// sticky
|
||||
$(window).on('scroll', function () {
|
||||
var scroll = $(window).scrollTop();
|
||||
if (scroll < 245) {
|
||||
$("#header-sticky").removeClass("sticky-menu");
|
||||
} else {
|
||||
$("#header-sticky").addClass("sticky-menu");
|
||||
}
|
||||
});
|
||||
|
||||
// RESPONSIVE MENU
|
||||
$('.responsive').on('click', function (e) {
|
||||
$('#mobile-menu').slideToggle();
|
||||
});
|
||||
|
||||
|
||||
|
||||
// menu toggle
|
||||
$(".main-menu li a").on('click', function () {
|
||||
if ($(window).width() < 1200) {
|
||||
$("#mobile-menu").slideUp();
|
||||
}
|
||||
});
|
||||
|
||||
// smoth scroll
|
||||
$(function () {
|
||||
$('a.smoth-scroll').on('click', function (event) {
|
||||
var $anchor = $(this);
|
||||
$('html, body').stop().animate({
|
||||
scrollTop: $($anchor.attr('href')).offset().top - 100
|
||||
}, 1000);
|
||||
event.preventDefault();
|
||||
});
|
||||
});
|
||||
|
||||
// mainSlider
|
||||
function mainSlider() {
|
||||
var BasicSlider = $('.slider-active');
|
||||
BasicSlider.on('init', function (e, slick) {
|
||||
var $firstAnimatingElements = $('.single-slider:first-child').find('[data-animation]');
|
||||
doAnimations($firstAnimatingElements);
|
||||
});
|
||||
BasicSlider.on('beforeChange', function (e, slick, currentSlide, nextSlide) {
|
||||
var $animatingElements = $('.single-slider[data-slick-index="' + nextSlide + '"]').find('[data-animation]');
|
||||
doAnimations($animatingElements);
|
||||
});
|
||||
BasicSlider.slick({
|
||||
autoplay: true,
|
||||
autoplaySpeed: 10000,
|
||||
dots: false,
|
||||
fade: true,
|
||||
arrows: true,
|
||||
prevArrow: '<button type="button" class="slick-prev"><i class="icon dripicons-chevron-left"></i></button>',
|
||||
nextArrow: '<button type="button" class="slick-next"><i class="icon dripicons-chevron-right"></i></button>',
|
||||
responsive: [
|
||||
{ breakpoint: 1200, settings: { dots: false, arrows: false } }
|
||||
]
|
||||
});
|
||||
|
||||
function doAnimations(elements) {
|
||||
var animationEndEvents = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
|
||||
elements.each(function () {
|
||||
var $this = $(this);
|
||||
var $animationDelay = $this.data('delay');
|
||||
var $animationType = 'animated ' + $this.data('animation');
|
||||
$this.css({
|
||||
'animation-delay': $animationDelay,
|
||||
'-webkit-animation-delay': $animationDelay
|
||||
});
|
||||
$this.addClass($animationType).one(animationEndEvents, function () {
|
||||
$this.removeClass($animationType);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
mainSlider();
|
||||
|
||||
|
||||
// services-active
|
||||
$('.services-active').slick({
|
||||
dots: true,
|
||||
infinite: true,
|
||||
arrows: false,
|
||||
speed: 1000,
|
||||
slidesToShow: 3,
|
||||
slidesToScroll: 1,
|
||||
responsive: [
|
||||
{
|
||||
breakpoint: 1200,
|
||||
settings: {
|
||||
slidesToShow: 3,
|
||||
slidesToScroll: 1,
|
||||
infinite: true,
|
||||
dots: true
|
||||
}
|
||||
},
|
||||
{
|
||||
breakpoint: 992,
|
||||
settings: {
|
||||
slidesToShow: 2,
|
||||
slidesToScroll: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
breakpoint: 767,
|
||||
settings: {
|
||||
slidesToShow: 1,
|
||||
slidesToScroll: 1
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
// services-active
|
||||
$('.blog-active2').slick({
|
||||
infinite: true,
|
||||
arrows: true,
|
||||
speed: 1000,
|
||||
slidesToShow: 3,
|
||||
slidesToScroll: 1,
|
||||
responsive: [
|
||||
{
|
||||
breakpoint: 1200,
|
||||
settings: {
|
||||
slidesToShow: 3,
|
||||
slidesToScroll: 1,
|
||||
infinite: true,
|
||||
arrows: true
|
||||
}
|
||||
},
|
||||
{
|
||||
breakpoint: 992,
|
||||
settings: {
|
||||
slidesToShow: 2,
|
||||
slidesToScroll: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
breakpoint: 767,
|
||||
settings: {
|
||||
slidesToShow: 1,
|
||||
slidesToScroll: 1
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
// brand-active
|
||||
$('.brand-active').slick({
|
||||
dots: false,
|
||||
infinite: true,
|
||||
arrows: false,
|
||||
speed: 1000,
|
||||
slidesToShow: 6,
|
||||
slidesToScroll: 2,
|
||||
responsive: [
|
||||
{
|
||||
breakpoint: 1500,
|
||||
settings: {
|
||||
slidesToShow: 6,
|
||||
slidesToScroll: 3,
|
||||
infinite: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
breakpoint: 1200,
|
||||
settings: {
|
||||
slidesToShow: 5,
|
||||
slidesToScroll: 3,
|
||||
infinite: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
breakpoint: 992,
|
||||
settings: {
|
||||
slidesToShow: 3,
|
||||
slidesToScroll: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
breakpoint: 767,
|
||||
settings: {
|
||||
slidesToShow: 2,
|
||||
slidesToScroll: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
breakpoint: 480,
|
||||
settings: {
|
||||
slidesToShow: 1,
|
||||
slidesToScroll: 1
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
// testimonial-active
|
||||
$('.testimonial-active').slick({
|
||||
dots: false,
|
||||
infinite: true,
|
||||
arrows: true,
|
||||
prevArrow: '<button type="button" class="slick-prev"><i class="icon dripicons-arrow-thin-left"></i></button>',
|
||||
nextArrow: '<button type="button" class="slick-next"><i class="icon dripicons-arrow-thin-right"></i></button>',
|
||||
speed: 1000,
|
||||
slidesToShow: 1,
|
||||
slidesToScroll: 1,
|
||||
responsive: [
|
||||
{
|
||||
breakpoint: 1024,
|
||||
settings: {
|
||||
slidesToShow: 1,
|
||||
slidesToScroll: 1,
|
||||
infinite: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
breakpoint: 600,
|
||||
settings: {
|
||||
slidesToShow: 1,
|
||||
slidesToScroll: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
breakpoint: 480,
|
||||
settings: {
|
||||
slidesToShow: 1,
|
||||
slidesToScroll: 1
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
// blog
|
||||
$('.blog-active').slick({
|
||||
dots: false,
|
||||
infinite: true,
|
||||
arrows: true,
|
||||
speed: 1500,
|
||||
slidesToShow: 1,
|
||||
slidesToScroll: 1,
|
||||
fade: true,
|
||||
prevArrow: '<button type="button" class="slick-prev"><i class="fas fa-arrow-left"></i></button>',
|
||||
nextArrow: '<button type="button" class="slick-next"><i class="fas fa-arrow-right"></i></button>',
|
||||
});
|
||||
|
||||
// counterUp
|
||||
|
||||
$('.count').counterUp({
|
||||
delay: 100,
|
||||
time: 1000
|
||||
});
|
||||
|
||||
/* magnificPopup img view */
|
||||
$('.popup-image').magnificPopup({
|
||||
type: 'image',
|
||||
gallery: {
|
||||
enabled: true
|
||||
}
|
||||
});
|
||||
|
||||
/* magnificPopup video view */
|
||||
$('.popup-video').magnificPopup({
|
||||
type: 'iframe'
|
||||
});
|
||||
|
||||
// paroller
|
||||
if ($('.paroller').length) {
|
||||
$('.paroller').paroller();
|
||||
}
|
||||
|
||||
//* Parallaxmouse js
|
||||
function parallaxMouse() {
|
||||
if ($('#parallax').length) {
|
||||
var scene = document.getElementById('parallax');
|
||||
var parallax = new Parallax(scene);
|
||||
};
|
||||
};
|
||||
parallaxMouse();
|
||||
|
||||
// service active
|
||||
$('.s-single-services').on('mouseenter', function () {
|
||||
$(this).addClass('active').parent().siblings().find('.s-single-services').removeClass('active');
|
||||
})
|
||||
|
||||
// scrollToTop
|
||||
$.scrollUp({
|
||||
scrollName: 'scrollUp',
|
||||
topDistance: '300',
|
||||
topSpeed: 300,
|
||||
animation: 'fade',
|
||||
animationInSpeed: 200,
|
||||
animationOutSpeed: 200,
|
||||
scrollText: '<i class="fas fa-level-up-alt"></i>',
|
||||
activeOverlay: false,
|
||||
});
|
||||
|
||||
// WOW active
|
||||
new WOW().init();
|
||||
|
||||
|
||||
})(jQuery);
|
19
dreamtech.hk/mtHK.github.io-main/js/one-page-nav-min.js
vendored
Normal file
19
dreamtech.hk/mtHK.github.io-main/js/one-page-nav-min.js
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* jQuery One Page Nav Plugin
|
||||
* http://github.com/davist11/jQuery-One-Page-Nav
|
||||
*
|
||||
* Copyright (c) 2010 Trevor Davis (http://trevordavis.net)
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* Uses the same license as jQuery, see:
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* @version 3.0.0
|
||||
*
|
||||
* Example usage:
|
||||
* $('#nav').onePageNav({
|
||||
* currentClass: 'current',
|
||||
* changeHash: false,
|
||||
* scrollSpeed: 750
|
||||
* });
|
||||
*/
|
||||
!function (t, i, n, s) { var e = function (s, e) { this.elem = s, this.$elem = t(s), this.options = e, this.metadata = this.$elem.data("plugin-options"), this.$win = t(i), this.sections = {}, this.didScroll = !1, this.$doc = t(n), this.docHeight = this.$doc.height() }; e.prototype = { defaults: { navItems: "a", currentClass: "current", changeHash: !1, easing: "swing", filter: "", scrollSpeed: 750, scrollThreshold: .5, begin: !1, end: !1, scrollChange: !1 }, init: function () { return this.config = t.extend({}, this.defaults, this.options, this.metadata), this.$nav = this.$elem.find(this.config.navItems), "" !== this.config.filter && (this.$nav = this.$nav.filter(this.config.filter)), this.$nav.on("click.onePageNav", t.proxy(this.handleClick, this)), this.getPositions(), this.bindInterval(), this.$win.on("resize.onePageNav", t.proxy(this.getPositions, this)), this }, adjustNav: function (t, i) { t.$elem.find("." + t.config.currentClass).removeClass(t.config.currentClass), i.addClass(t.config.currentClass) }, bindInterval: function () { var t, i = this; i.$win.on("scroll.onePageNav", function () { i.didScroll = !0 }), i.t = setInterval(function () { t = i.$doc.height(), i.didScroll && (i.didScroll = !1, i.scrollChange()), t !== i.docHeight && (i.docHeight = t, i.getPositions()) }, 250) }, getHash: function (t) { return t.attr("href").split("#")[1] }, getPositions: function () { var i, n, s, e = this; e.$nav.each(function () { i = e.getHash(t(this)), s = t("#" + i), s.length && (n = s.offset().top, e.sections[i] = Math.round(n)) }) }, getSection: function (t) { var i = null, n = Math.round(this.$win.height() * this.config.scrollThreshold); for (var s in this.sections) this.sections[s] - n < t && (i = s); return i }, handleClick: function (n) { var s = this, e = t(n.currentTarget), o = e.parent(), a = "#" + s.getHash(e); o.hasClass(s.config.currentClass) || (s.config.begin && s.config.begin(), s.adjustNav(s, o), s.unbindInterval(), s.scrollTo(a, function () { s.config.changeHash && (i.location.hash = a), s.bindInterval(), s.config.end && s.config.end() })), n.preventDefault() }, scrollChange: function () { var t, i = this.$win.scrollTop(), n = this.getSection(i); null !== n && (t = this.$elem.find('a[href$="#' + n + '"]').parent(), t.hasClass(this.config.currentClass) || (this.adjustNav(this, t), this.config.scrollChange && this.config.scrollChange(t))) }, scrollTo: function (i, n) { var s = t(i).offset().top; t("html, body").animate({ scrollTop: s - this.config.scrollOffset }, this.config.scrollSpeed, this.config.easing, n) }, unbindInterval: function () { clearInterval(this.t), this.$win.unbind("scroll.onePageNav") } }, e.defaults = e.prototype.defaults, t.fn.onePageNav = function (t) { return this.each(function () { new e(this, t).init() }) } }(jQuery, window, document);
|
169
dreamtech.hk/mtHK.github.io-main/js/parallax.min.js
vendored
Normal file
169
dreamtech.hk/mtHK.github.io-main/js/parallax.min.js
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
! function (t, i, e) {
|
||||
"use strict";
|
||||
|
||||
function s(t, i) {
|
||||
this.element = t, this.layers = t.getElementsByClassName("layer");
|
||||
var e = {
|
||||
calibrateX: this.data(this.element, "calibrate-x"),
|
||||
calibrateY: this.data(this.element, "calibrate-y"),
|
||||
invertX: this.data(this.element, "invert-x"),
|
||||
invertY: this.data(this.element, "invert-y"),
|
||||
limitX: this.data(this.element, "limit-x"),
|
||||
limitY: this.data(this.element, "limit-y"),
|
||||
scalarX: this.data(this.element, "scalar-x"),
|
||||
scalarY: this.data(this.element, "scalar-y"),
|
||||
frictionX: this.data(this.element, "friction-x"),
|
||||
frictionY: this.data(this.element, "friction-y"),
|
||||
originX: this.data(this.element, "origin-x"),
|
||||
originY: this.data(this.element, "origin-y")
|
||||
};
|
||||
for (var s in e) null === e[s] && delete e[s];
|
||||
this.extend(this, r, i, e), this.calibrationTimer = null, this.calibrationFlag = !0, this.enabled = !1, this.depths = [], this.raf = null, this.bounds = null, this.ex = 0, this.ey = 0, this.ew = 0, this.eh = 0, this.ecx = 0, this.ecy = 0, this.erx = 0, this.ery = 0, this.cx = 0, this.cy = 0, this.ix = 0, this.iy = 0, this.mx = 0, this.my = 0, this.vx = 0, this.vy = 0, this.onMouseMove = this.onMouseMove.bind(this), this.onDeviceOrientation = this.onDeviceOrientation.bind(this), this.onOrientationTimer = this.onOrientationTimer.bind(this), this.onCalibrationTimer = this.onCalibrationTimer.bind(this), this.onAnimationFrame = this.onAnimationFrame.bind(this), this.onWindowResize = this.onWindowResize.bind(this), this.initialise()
|
||||
}
|
||||
var n = "Parallax",
|
||||
o = 30,
|
||||
r = {
|
||||
relativeInput: !1,
|
||||
clipRelativeInput: !1,
|
||||
calibrationThreshold: 100,
|
||||
calibrationDelay: 500,
|
||||
supportDelay: 500,
|
||||
calibrateX: !1,
|
||||
calibrateY: !0,
|
||||
invertX: !0,
|
||||
invertY: !0,
|
||||
limitX: !1,
|
||||
limitY: !1,
|
||||
scalarX: 10,
|
||||
scalarY: 10,
|
||||
frictionX: .1,
|
||||
frictionY: .1,
|
||||
originX: .5,
|
||||
originY: .5
|
||||
};
|
||||
s.prototype.extend = function () {
|
||||
if (arguments.length > 1)
|
||||
for (var t = arguments[0], i = 1, e = arguments.length; e > i; i++) {
|
||||
var s = arguments[i];
|
||||
for (var n in s) t[n] = s[n]
|
||||
}
|
||||
}, s.prototype.data = function (t, i) {
|
||||
return this.deserialize(t.getAttribute("data-" + i))
|
||||
}, s.prototype.deserialize = function (t) {
|
||||
return "true" === t ? !0 : "false" === t ? !1 : "null" === t ? null : !isNaN(parseFloat(t)) && isFinite(t) ? parseFloat(t) : t
|
||||
}, s.prototype.camelCase = function (t) {
|
||||
return t.replace(/-+(.)?/g, function (t, i) {
|
||||
return i ? i.toUpperCase() : ""
|
||||
})
|
||||
}, s.prototype.transformSupport = function (s) {
|
||||
for (var n = i.createElement("div"), o = !1, r = null, a = !1, h = null, l = null, p = 0, c = this.vendors.length; c > p; p++)
|
||||
if (null !== this.vendors[p] ? (h = this.vendors[p][0] + "transform", l = this.vendors[p][1] + "Transform") : (h = "transform", l = "transform"), n.style[l] !== e) {
|
||||
o = !0;
|
||||
break
|
||||
}
|
||||
switch (s) {
|
||||
case "2D":
|
||||
a = o;
|
||||
break;
|
||||
case "3D":
|
||||
if (o) {
|
||||
var m = i.body || i.createElement("body"),
|
||||
u = i.documentElement,
|
||||
y = u.style.overflow;
|
||||
i.body || (u.style.overflow = "hidden", u.appendChild(m), m.style.overflow = "hidden", m.style.background = ""), m.appendChild(n), n.style[l] = "translate3d(1px,1px,1px)", r = t.getComputedStyle(n).getPropertyValue(h), a = r !== e && r.length > 0 && "none" !== r, u.style.overflow = y, m.removeChild(n)
|
||||
}
|
||||
}
|
||||
return a
|
||||
}, s.prototype.ww = null, s.prototype.wh = null, s.prototype.wcx = null, s.prototype.wcy = null, s.prototype.wrx = null, s.prototype.wry = null, s.prototype.portrait = null, s.prototype.desktop = !navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry|BB10|mobi|tablet|opera mini|nexus 7)/i), s.prototype.vendors = [null, ["-webkit-", "webkit"], ["-moz-", "Moz"], ["-o-", "O"], ["-ms-", "ms"]], s.prototype.motionSupport = !!t.DeviceMotionEvent, s.prototype.orientationSupport = !!t.DeviceOrientationEvent, s.prototype.orientationStatus = 0, s.prototype.transform2DSupport = s.prototype.transformSupport("2D"), s.prototype.transform3DSupport = s.prototype.transformSupport("3D"), s.prototype.propertyCache = {}, s.prototype.initialise = function () {
|
||||
this.transform3DSupport && this.accelerate(this.element);
|
||||
var i = t.getComputedStyle(this.element);
|
||||
"static" === i.getPropertyValue("position") && (this.element.style.position = "relative"), this.updateLayers(), this.updateDimensions(), this.enable(), this.queueCalibration(this.calibrationDelay)
|
||||
}, s.prototype.updateLayers = function () {
|
||||
this.layers = this.element.getElementsByClassName("layer"), this.depths = [];
|
||||
for (var t = 0, i = this.layers.length; i > t; t++) {
|
||||
var e = this.layers[t];
|
||||
this.transform3DSupport && this.accelerate(e), e.style.position = t ? "absolute" : "relative", e.style.display = "block", e.style.left = 0, e.style.top = 0, this.depths.push(this.data(e, "depth") || 0)
|
||||
}
|
||||
}, s.prototype.updateDimensions = function () {
|
||||
this.ww = t.innerWidth, this.wh = t.innerHeight, this.wcx = this.ww * this.originX, this.wcy = this.wh * this.originY, this.wrx = Math.max(this.wcx, this.ww - this.wcx), this.wry = Math.max(this.wcy, this.wh - this.wcy)
|
||||
}, s.prototype.updateBounds = function () {
|
||||
this.bounds = this.element.getBoundingClientRect(), this.ex = this.bounds.left, this.ey = this.bounds.top, this.ew = this.bounds.width, this.eh = this.bounds.height, this.ecx = this.ew * this.originX, this.ecy = this.eh * this.originY, this.erx = Math.max(this.ecx, this.ew - this.ecx), this.ery = Math.max(this.ecy, this.eh - this.ecy)
|
||||
}, s.prototype.queueCalibration = function (t) {
|
||||
clearTimeout(this.calibrationTimer), this.calibrationTimer = setTimeout(this.onCalibrationTimer, t)
|
||||
}, s.prototype.enable = function () {
|
||||
this.enabled || (this.enabled = !0, this.orientationSupport ? (this.portrait = null, t.addEventListener("deviceorientation", this.onDeviceOrientation), setTimeout(this.onOrientationTimer, this.supportDelay)) : (this.cx = 0, this.cy = 0, this.portrait = !1, t.addEventListener("mousemove", this.onMouseMove)), t.addEventListener("resize", this.onWindowResize), this.raf = requestAnimationFrame(this.onAnimationFrame))
|
||||
}, s.prototype.disable = function () {
|
||||
this.enabled && (this.enabled = !1, this.orientationSupport ? t.removeEventListener("deviceorientation", this.onDeviceOrientation) : t.removeEventListener("mousemove", this.onMouseMove), t.removeEventListener("resize", this.onWindowResize), cancelAnimationFrame(this.raf))
|
||||
}, s.prototype.calibrate = function (t, i) {
|
||||
this.calibrateX = t === e ? this.calibrateX : t, this.calibrateY = i === e ? this.calibrateY : i
|
||||
}, s.prototype.invert = function (t, i) {
|
||||
this.invertX = t === e ? this.invertX : t, this.invertY = i === e ? this.invertY : i
|
||||
}, s.prototype.friction = function (t, i) {
|
||||
this.frictionX = t === e ? this.frictionX : t, this.frictionY = i === e ? this.frictionY : i
|
||||
}, s.prototype.scalar = function (t, i) {
|
||||
this.scalarX = t === e ? this.scalarX : t, this.scalarY = i === e ? this.scalarY : i
|
||||
}, s.prototype.limit = function (t, i) {
|
||||
this.limitX = t === e ? this.limitX : t, this.limitY = i === e ? this.limitY : i
|
||||
}, s.prototype.origin = function (t, i) {
|
||||
this.originX = t === e ? this.originX : t, this.originY = i === e ? this.originY : i
|
||||
}, s.prototype.clamp = function (t, i, e) {
|
||||
return t = Math.max(t, i), t = Math.min(t, e)
|
||||
}, s.prototype.css = function (t, i, s) {
|
||||
var n = this.propertyCache[i];
|
||||
if (!n)
|
||||
for (var o = 0, r = this.vendors.length; r > o; o++)
|
||||
if (n = null !== this.vendors[o] ? this.camelCase(this.vendors[o][1] + "-" + i) : i, t.style[n] !== e) {
|
||||
this.propertyCache[i] = n;
|
||||
break
|
||||
}
|
||||
t.style[n] = s
|
||||
}, s.prototype.accelerate = function (t) {
|
||||
this.css(t, "transform", "translate3d(0,0,0)"), this.css(t, "transform-style", "preserve-3d"), this.css(t, "backface-visibility", "hidden")
|
||||
}, s.prototype.setPosition = function (t, i, e) {
|
||||
i += "px", e += "px", this.transform3DSupport ? this.css(t, "transform", "translate3d(" + i + "," + e + ",0)") : this.transform2DSupport ? this.css(t, "transform", "translate(" + i + "," + e + ")") : (t.style.left = i, t.style.top = e)
|
||||
}, s.prototype.onOrientationTimer = function () {
|
||||
this.orientationSupport && 0 === this.orientationStatus && (this.disable(), this.orientationSupport = !1, this.enable())
|
||||
}, s.prototype.onCalibrationTimer = function () {
|
||||
this.calibrationFlag = !0
|
||||
}, s.prototype.onWindowResize = function () {
|
||||
this.updateDimensions()
|
||||
}, s.prototype.onAnimationFrame = function () {
|
||||
this.updateBounds();
|
||||
var t = this.ix - this.cx,
|
||||
i = this.iy - this.cy;
|
||||
(Math.abs(t) > this.calibrationThreshold || Math.abs(i) > this.calibrationThreshold) && this.queueCalibration(0), this.portrait ? (this.mx = this.calibrateX ? i : this.iy, this.my = this.calibrateY ? t : this.ix) : (this.mx = this.calibrateX ? t : this.ix, this.my = this.calibrateY ? i : this.iy), this.mx *= this.ew * (this.scalarX / 100), this.my *= this.eh * (this.scalarY / 100), isNaN(parseFloat(this.limitX)) || (this.mx = this.clamp(this.mx, -this.limitX, this.limitX)), isNaN(parseFloat(this.limitY)) || (this.my = this.clamp(this.my, -this.limitY, this.limitY)), this.vx += (this.mx - this.vx) * this.frictionX, this.vy += (this.my - this.vy) * this.frictionY;
|
||||
for (var e = 0, s = this.layers.length; s > e; e++) {
|
||||
var n = this.layers[e],
|
||||
o = this.depths[e],
|
||||
r = this.vx * o * (this.invertX ? -1 : 1),
|
||||
a = this.vy * o * (this.invertY ? -1 : 1);
|
||||
this.setPosition(n, r, a)
|
||||
}
|
||||
this.raf = requestAnimationFrame(this.onAnimationFrame)
|
||||
}, s.prototype.onDeviceOrientation = function (t) {
|
||||
if (!this.desktop && null !== t.beta && null !== t.gamma) {
|
||||
this.orientationStatus = 1;
|
||||
var i = (t.beta || 0) / o,
|
||||
e = (t.gamma || 0) / o,
|
||||
s = this.wh > this.ww;
|
||||
this.portrait !== s && (this.portrait = s, this.calibrationFlag = !0), this.calibrationFlag && (this.calibrationFlag = !1, this.cx = i, this.cy = e), this.ix = i, this.iy = e
|
||||
}
|
||||
}, s.prototype.onMouseMove = function (t) {
|
||||
var i = t.clientX,
|
||||
e = t.clientY;
|
||||
!this.orientationSupport && this.relativeInput ? (this.clipRelativeInput && (i = Math.max(i, this.ex), i = Math.min(i, this.ex + this.ew), e = Math.max(e, this.ey), e = Math.min(e, this.ey + this.eh)), this.ix = (i - this.ex - this.ecx) / this.erx, this.iy = (e - this.ey - this.ecy) / this.ery) : (this.ix = (i - this.wcx) / this.wrx, this.iy = (e - this.wcy) / this.wry)
|
||||
}, t[n] = s
|
||||
}(window, document),
|
||||
function () {
|
||||
for (var t = 0, i = ["ms", "moz", "webkit", "o"], e = 0; e < i.length && !window.requestAnimationFrame; ++e) window.requestAnimationFrame = window[i[e] + "RequestAnimationFrame"], window.cancelAnimationFrame = window[i[e] + "CancelAnimationFrame"] || window[i[e] + "CancelRequestAnimationFrame"];
|
||||
window.requestAnimationFrame || (window.requestAnimationFrame = function (i) {
|
||||
var e = (new Date).getTime(),
|
||||
s = Math.max(0, 16 - (e - t)),
|
||||
n = window.setTimeout(function () {
|
||||
i(e + s)
|
||||
}, s);
|
||||
return t = e + s, n
|
||||
}), window.cancelAnimationFrame || (window.cancelAnimationFrame = function (t) {
|
||||
clearTimeout(t)
|
||||
})
|
||||
}();
|
219
dreamtech.hk/mtHK.github.io-main/js/paroller.js
Normal file
219
dreamtech.hk/mtHK.github.io-main/js/paroller.js
Normal file
@@ -0,0 +1,219 @@
|
||||
/**
|
||||
* jQuery plugin paroller.js v1.4.4
|
||||
* https://github.com/tgomilar/paroller.js
|
||||
* preview: https://tgomilar.github.io/paroller/
|
||||
**/
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define('parollerjs', ['jquery'], factory);
|
||||
} else if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
module.exports = factory(require('jquery'));
|
||||
}
|
||||
else {
|
||||
factory(jQuery);
|
||||
}
|
||||
})(function ($) {
|
||||
'use strict';
|
||||
|
||||
var working = false;
|
||||
var scrollAction = function() {
|
||||
working = false;
|
||||
};
|
||||
|
||||
var setDirection = {
|
||||
bgVertical: function (elem, bgOffset) {
|
||||
return elem.css({'background-position': 'center ' + -bgOffset + 'px'});
|
||||
},
|
||||
bgHorizontal: function (elem, bgOffset) {
|
||||
return elem.css({'background-position': -bgOffset + 'px' + ' center'});
|
||||
},
|
||||
vertical: function (elem, elemOffset, oldTransform) {
|
||||
(oldTransform === 'none' ? oldTransform = '' : true);
|
||||
return elem.css({
|
||||
'-webkit-transform': 'translateY(' + elemOffset + 'px)' + oldTransform,
|
||||
'-moz-transform': 'translateY(' + elemOffset + 'px)' + oldTransform,
|
||||
'transform': 'translateY(' + elemOffset + 'px)' + oldTransform,
|
||||
'transition': 'transform linear',
|
||||
'will-change': 'transform'
|
||||
});
|
||||
},
|
||||
horizontal: function (elem, elemOffset, oldTransform) {
|
||||
(oldTransform === 'none' ? oldTransform = '' : true);
|
||||
return elem.css({
|
||||
'-webkit-transform': 'translateX(' + elemOffset + 'px)' + oldTransform,
|
||||
'-moz-transform': 'translateX(' + elemOffset + 'px)' + oldTransform,
|
||||
'transform': 'translateX(' + elemOffset + 'px)' + oldTransform,
|
||||
'transition': 'transform linear',
|
||||
'will-change': 'transform'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var setMovement = {
|
||||
factor: function (elem, width, options) {
|
||||
var dataFactor = elem.data('paroller-factor');
|
||||
var factor = (dataFactor) ? dataFactor : options.factor;
|
||||
if (width < 576) {
|
||||
var dataFactorXs = elem.data('paroller-factor-xs');
|
||||
var factorXs = (dataFactorXs) ? dataFactorXs : options.factorXs;
|
||||
return (factorXs) ? factorXs : factor;
|
||||
}
|
||||
else if (width <= 768) {
|
||||
var dataFactorSm = elem.data('paroller-factor-sm');
|
||||
var factorSm = (dataFactorSm) ? dataFactorSm : options.factorSm;
|
||||
return (factorSm) ? factorSm : factor;
|
||||
}
|
||||
else if (width <= 1024) {
|
||||
var dataFactorMd = elem.data('paroller-factor-md');
|
||||
var factorMd = (dataFactorMd) ? dataFactorMd : options.factorMd;
|
||||
return (factorMd) ? factorMd : factor;
|
||||
}
|
||||
else if (width <= 1200) {
|
||||
var dataFactorLg = elem.data('paroller-factor-lg');
|
||||
var factorLg = (dataFactorLg) ? dataFactorLg : options.factorLg;
|
||||
return (factorLg) ? factorLg : factor;
|
||||
} else if (width <= 1920) {
|
||||
var dataFactorXl = elem.data('paroller-factor-xl');
|
||||
var factorXl = (dataFactorXl) ? dataFactorXl : options.factorXl;
|
||||
return (factorXl) ? factorXl : factor;
|
||||
} else {
|
||||
return factor;
|
||||
}
|
||||
},
|
||||
bgOffset: function (offset, factor) {
|
||||
return Math.round(offset * factor);
|
||||
},
|
||||
transform: function (offset, factor, windowHeight, height) {
|
||||
return Math.round((offset - (windowHeight / 2) + height) * factor);
|
||||
}
|
||||
};
|
||||
|
||||
var clearPositions = {
|
||||
background: function (elem) {
|
||||
return elem.css({'background-position': 'unset'});
|
||||
},
|
||||
foreground: function (elem) {
|
||||
return elem.css({
|
||||
'transform' : 'unset',
|
||||
'transition' : 'unset'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.paroller = function (options) {
|
||||
var windowHeight = $(window).height();
|
||||
var documentHeight = $(document).height();
|
||||
|
||||
// default options
|
||||
var options = $.extend({
|
||||
factor: 0, // - to +
|
||||
factorXs: 0, // - to +
|
||||
factorSm: 0, // - to +
|
||||
factorMd: 0, // - to +
|
||||
factorLg: 0, // - to +
|
||||
factorXl: 0, // - to +
|
||||
type: 'background', // foreground
|
||||
direction: 'vertical' // horizontal
|
||||
}, options);
|
||||
|
||||
return this.each(function () {
|
||||
var $this = $(this);
|
||||
var width = $(window).width();
|
||||
var offset = $this.offset().top;
|
||||
var height = $this.outerHeight();
|
||||
|
||||
var dataType = $this.data('paroller-type');
|
||||
var dataDirection = $this.data('paroller-direction');
|
||||
var oldTransform = $this.css('transform');
|
||||
|
||||
var type = (dataType) ? dataType : options.type;
|
||||
var direction = (dataDirection) ? dataDirection : options.direction;
|
||||
var factor = setMovement.factor($this, width, options);
|
||||
var bgOffset = setMovement.bgOffset(offset, factor);
|
||||
var transform = setMovement.transform(offset, factor, windowHeight, height);
|
||||
|
||||
if (type === 'background') {
|
||||
if (direction === 'vertical') {
|
||||
setDirection.bgVertical($this, bgOffset);
|
||||
}
|
||||
else if (direction === 'horizontal') {
|
||||
setDirection.bgHorizontal($this, bgOffset);
|
||||
}
|
||||
}
|
||||
else if (type === 'foreground') {
|
||||
if (direction === 'vertical') {
|
||||
setDirection.vertical($this, transform, oldTransform);
|
||||
}
|
||||
else if (direction === 'horizontal') {
|
||||
setDirection.horizontal($this, transform, oldTransform);
|
||||
}
|
||||
}
|
||||
|
||||
$(window).on('resize', function () {
|
||||
var scrolling = $(this).scrollTop();
|
||||
width = $(window).width();
|
||||
offset = $this.offset().top;
|
||||
height = $this.outerHeight();
|
||||
factor = setMovement.factor($this, width, options);
|
||||
|
||||
bgOffset = Math.round(offset * factor);
|
||||
transform = Math.round((offset - (windowHeight / 2) + height) * factor);
|
||||
|
||||
if (! working) {
|
||||
window.requestAnimationFrame(scrollAction);
|
||||
working = true;
|
||||
}
|
||||
|
||||
if (type === 'background') {
|
||||
clearPositions.background($this);
|
||||
if (direction === 'vertical') {
|
||||
setDirection.bgVertical($this, bgOffset);
|
||||
}
|
||||
else if (direction === 'horizontal') {
|
||||
setDirection.bgHorizontal($this, bgOffset);
|
||||
}
|
||||
}
|
||||
else if ((type === 'foreground') && (scrolling <= documentHeight)) {
|
||||
clearPositions.foreground($this);
|
||||
if (direction === 'vertical') {
|
||||
setDirection.vertical($this, transform);
|
||||
}
|
||||
else if (direction === 'horizontal') {
|
||||
setDirection.horizontal($this, transform);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(window).on('scroll', function () {
|
||||
var scrolling = $(this).scrollTop();
|
||||
documentHeight = $(document).height();
|
||||
|
||||
bgOffset = Math.round((offset - scrolling) * factor);
|
||||
transform = Math.round(((offset - (windowHeight / 2) + height) - scrolling) * factor);
|
||||
|
||||
if (! working) {
|
||||
window.requestAnimationFrame(scrollAction);
|
||||
working = true;
|
||||
}
|
||||
|
||||
if (type === 'background') {
|
||||
if (direction === 'vertical') {
|
||||
setDirection.bgVertical($this, bgOffset);
|
||||
}
|
||||
else if (direction === 'horizontal') {
|
||||
setDirection.bgHorizontal($this, bgOffset);
|
||||
}
|
||||
}
|
||||
else if ((type === 'foreground') && (scrolling <= documentHeight)) {
|
||||
if (direction === 'vertical') {
|
||||
setDirection.vertical($this, transform, oldTransform);
|
||||
}
|
||||
else if (direction === 'horizontal') {
|
||||
setDirection.horizontal($this, transform, oldTransform);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
5
dreamtech.hk/mtHK.github.io-main/js/popper.min.js
vendored
Normal file
5
dreamtech.hk/mtHK.github.io-main/js/popper.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dreamtech.hk/mtHK.github.io-main/js/slick.min.js
vendored
Normal file
1
dreamtech.hk/mtHK.github.io-main/js/slick.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
dreamtech.hk/mtHK.github.io-main/js/vendor/jquery-1.12.4.min.js
vendored
Normal file
5
dreamtech.hk/mtHK.github.io-main/js/vendor/jquery-1.12.4.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
3
dreamtech.hk/mtHK.github.io-main/js/vendor/modernizr-3.5.0.min.js
vendored
Normal file
3
dreamtech.hk/mtHK.github.io-main/js/vendor/modernizr-3.5.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
dreamtech.hk/mtHK.github.io-main/js/wow.min.js
vendored
Normal file
2
dreamtech.hk/mtHK.github.io-main/js/wow.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user