//prevent # links from moving to top $('a[href="#"][data-top!=true]').click(function(e){ e.preventDefault(); }); //产品 window.onload = function () { var oBut = document.getElementById('list'); var oTop = document.getElementById('top'); var oTli = oTop.getElementsByTagName('li'); var aLi = oBut.getElementsByTagName('li'); var aA = oBut.getElementsByTagName('a'); var aP = getClass(oBut, 'b_tit'); var oSmall = getClass(oTop, 'small')[0]; var i = iNow = 0; var timer = null; var aSort = []; var aPosition = [ { width: 344, height: 440, top: 0, left: 352, zIndex: 10 }, { width: 260, height: 332, top: 56, left: 148, zIndex: 8 }, { width: 204, height: 260, top: 92, left: 0, zIndex: 6 }, { width: 140, height: 180, top: 132, left: 148, zIndex: 4 }, { width: 110, height: 140, top: 172, left: 232, zIndex: 2 }, { width: 110, height: 140, top: 172, left: 708, zIndex: 2 }, { width: 140, height: 180, top: 132, left: 770, zIndex: 4 }, { width: 204, height: 260, top: 92, left: 844, zIndex: 6 }, { width: 260, height: 332, top: 56, left: 640, zIndex: 8 } ] for (i = 0; i < oTli.length; i++) { oTli[i].index = i; myAddEvent(oTli[i], 'mouseover', function () { startMove(this, { opacity: 100 }); }) myAddEvent(oTli[i], 'mouseout', function () { if (this.className != 'hove') startMove(this, { opacity: 40 }); }) myAddEvent(oTli[i], 'click', function () { iNow = this.index; tab(); }) } for (i = 0; i < aLi.length; i++) { aLi[i].index = i; aLi[i].style.width = aPosition[i].width + 'px'; aLi[i].style.height = aPosition[i].height + 'px'; aLi[i].style.top = aPosition[i].top + 'px'; aLi[i].style.left = aPosition[i].left + 'px'; aLi[i].style.zIndex = aPosition[i].zIndex; aSort[i] = aPosition[i]; myAddEvent(aLi[i], 'mouseover', function () { var oDiv = this.getElementsByTagName('div')[0]; startMove(oDiv, { opacity: 0 }); if (this.style.width == '344px') { startMove(aP[this.index], { bottom: 0 }); } }); myAddEvent(aLi[i], 'mouseout', function () { if (this.style.width == '344px') { startMove(aP[this.index], { bottom: -120 }); } else { var oDiv = this.getElementsByTagName('div')[0]; startMove(oDiv, { opacity: 75 }); } }); myAddEvent(aLi[i], 'click', function () { var iSort = this.index; iNow = this.index; Sort(); for (i = 0; i < iSort; i++) { aSort.unshift(aSort.pop()); } sMove(); }); } myAddEvent(aA[0], 'click', function () { aSort.unshift(aSort.pop()); sMove(); setInter(); }); myAddEvent(aA[1], 'click', function () { aSort.push(aSort.shift()); sMove(); iNow--; if (iNow < 0) iNow = aLi.length - 1; tab(); }); oSmall.onmouseover = oBut.onmouseover = function () { clearInterval(timer); }; oSmall.onmouseout = oBut.onmouseout = function () { clearInterval(timer); timer = setInterval(setInter, 5000); }; timer = setInterval(setInter, 5000); function setInter() { iNow++; if (iNow > aLi.length - 1) iNow = 0; tab(); } function tab() { for (i = 0; i < oTli.length; i++) oTli[i].className = '', startMove(oTli[i], { opacity: 40 }); oTli[iNow].className = 'hove'; startMove(oTli[iNow], { opacity: 100 }) var iSort = iNow; Sort(); for (i = 0; i < iSort; i++) { aSort.unshift(aSort.pop()); } sMove(); } function Sort() { for (i = 0; i < aLi.length; i++) { aSort[i] = aPosition[i]; } } function sMove() { for (i = 0; i < aLi.length; i++) { var oDiv = aLi[i].getElementsByTagName('div')[0]; startMove(oDiv, { opacity: 75 }); startMove(aLi[i], aSort[i], function () { one(); }); aLi[i].className = ''; } aLi[iNow].className = 'hove'; } function one() { for (i = 0; i < aLi.length; i++) { if (aLi[i].style.width == '344px') { var oDiv = aLi[i].getElementsByTagName('div')[0]; startMove(oDiv, { opacity: 0 }); } } } one(); }; function getClass(oParent, sClass) { var aElem = document.getElementsByTagName('*'); var aClass = []; var i = 0; for (i = 0; i < aElem.length; i++) if (aElem[i].className == sClass) aClass.push(aElem[i]); return aClass; } function myAddEvent(obj, sEvent, fn) { if (obj.attachEvent) { obj.attachEvent('on' + sEvent, function () { fn.call(obj); }); } else { obj.addEventListener(sEvent, fn, false); } } function startMove(obj, json, fnEnd) { if (obj.timer) clearInterval(obj.timer); obj.timer = setInterval(function () { doMove(obj, json, fnEnd); }, 30); } function getStyle(obj, attr) { return obj.currentStyle ? obj.currentStyle[attr] : getComputedStyle(obj, false)[attr]; } function doMove(obj, json, fnEnd) { var iCur = 0; var attr = ''; var bStop = true; for (attr in json) { attr == 'opacity' ? iCur = parseInt(100 * parseFloat(getStyle(obj, 'opacity'))) : iCur = parseInt(getStyle(obj, attr)); if (isNaN(iCur)) iCur = 0; if (navigator.userAgent.indexOf("MSIE 8.0") > 0) { var iSpeed = (json[attr] - iCur) / 3; } else { var iSpeed = (json[attr] - iCur) / 5; } iSpeed = iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed); if (parseInt(json[attr]) != iCur) bStop = false; if (attr == 'opacity') { obj.style.filter = "alpha(opacity:" + (iCur + iSpeed) + ")"; obj.style.opacity = (iCur + iSpeed) / 100; } else { attr == 'zIndex' ? obj.style[attr] = iCur + iSpeed : obj.style[attr] = iCur + iSpeed + 'px'; } } if (bStop) { clearInterval(obj.timer); obj.timer = null; if (fnEnd) fnEnd(); } } // SMOOTH SCROLL smoothScroll.init({ offset: 70 }); // ONEPAGE ACTIVE LINK jQuery(document).ready(function() { var sections = $('section') , nav = $('nav') , nav_height = nav.outerHeight(); $(window).on('scroll', function () { var cur_pos = $(this).scrollTop(); sections.each(function() { var top = $(this).offset().top - nav_height, bottom = top + $(this).outerHeight(); if (cur_pos >= top && cur_pos <= bottom) { nav.find('a').removeClass('active'); sections.removeClass('active'); $(this).addClass('active'); nav.find('a[href="#'+$(this).attr('id')+'"]').addClass('active'); } }); }); }); //DOWNLOAD function checkUser(ranks) { //判断是否登陆 var username = '<%=strSession %>'; if (username == "" || username == null) { $('#bt').click(); } else { //判断权限 //获得登陆后的用户组 var rank = '<%=strRank %>'; if (rank == "" || rank == null) { $('#bt').click(); } else { if (ranks.toString().indexOf(rank) == -1) { alert("你没有权限下载该文件。"); return; } else { var src = document.getElementById("urlSrc").value; window.open(src); } } } } function login() { var username = document.getElementById("username"); var pwd = document.getElementById("pwd"); if (username.value == null || username.value == "") { alert("请输入用户名"); return false; } if (pwd.value == null || pwd.value == "") { alert("请输入密码"); return false; } document.form1.submit(); } /* openID=显示按钮,conID=需要显示的div,closeID=关闭按钮 */ // SCROLL $(window).scroll(function() { var scroll = $(window).scrollTop(); if (scroll >= 180) { $(".navbar-transparent").addClass("navbar-scroll"); } else { $(".navbar-transparent").removeClass("navbar-scroll"); } }); // SCROLL $(window).scroll(function() { var scroll = $(window).scrollTop(); if (scroll >= 180) { $(".stay-top").addClass("navbar-scroll2"); } else { $(".stay-top").removeClass("navbar-scroll2"); } }); $(window).scroll(function() { var scroll = $(window).scrollTop(); if (scroll >= 100) { $(".navbar-fixed-top").addClass("has-bg"); } else { $(".navbar-fixed-top").removeClass("has-bg"); } }); // RESIZE $(window).on('resize', function(){ var win = $(this); if (win.width() < 1200) { $('.navbar-transparent').removeClass('navbar-fixed-top'); } else { $('.navbar-transparent').addClass('navbar-fixed-top'); } }); // BANNER $(function () { $('.flexslider').flexslider({ animation: "slide", start: function (slider) { $('body').removeClass('loading'); } }); }); jQuery(document).ready(function() { jQuery('#banner-fullwidth').show().revolution( { delay:6000, startwidth:1170, hideThumbs:300, navigationStyle: "preview4", spinner:"spinner4", }); jQuery('#banner-boxed').show().revolution( { delay:6000, startwidth:1170, startheight: 600, hideThumbs:300, navigationStyle:"preview4", spinner:"spinner4", }); jQuery('#banner-fullscreen').show().revolution( { delay:6000, startwidth:1170, startheight: 600, hideThumbs:300, navigationStyle:"preview4", fullScreen:"on", fullScreenOffsetContainer: "header", spinner:"spinner4", }); }); // SCROLL TO TOP $(document).ready(function(){ //Check to see if the window is top if not then display button $(window).scroll(function(){ if ($(this).scrollTop() > 100) { $('.scrollToTop').fadeIn(); } else { $('.scrollToTop').fadeOut(); } }); //Click event to scroll to top $('.scrollToTop').click(function(){ $('html, body').animate({scrollTop : 0},800); return false; }); }); // PRELOADER //// // PROGRESS ANIMATED jQuery(document).ready(function () { jQuery('.progress-animated').each(function () { jQuery(this).appear(function() { jQuery(this).animate({opacity:1,left:"0px"},800); var b = jQuery(this).find(".progress-bar").attr("data-width"); jQuery(this).find(".progress-bar").animate({ width: b + "%" }, 1300, "linear"); }); }); }); //GALLERY $('.popup-link').magnificPopup({ type: 'image', gallery:{ enabled:true } // other options }); // CLIENTS CAROUSEL $(document).ready(function() { var owl = $("#clients-3col"); owl.owlCarousel({ //items : 3, itemsCustom : [ [450,3], [600, 3], [768, 3], [980, 3], [1199, 3], [1400, 3], [1600, 3] ], autoPlay : true, pagination : false }); // Custom Navigation Events $(".next").click(function(){ owl.trigger('owl.next'); }) $(".prev").click(function(){ owl.trigger('owl.prev'); }) }); $(document).ready(function() { var owl = $("#clients-full"); owl.owlCarousel({ itemsCustom : [ [450,3], [600, 3], [768, 4], [980, 5], [1199, 5], [1400, 5], [1600, 5] ], autoPlay: true, navigationText: ["上一个","下一个"], pagination : true }); // Custom Navigation Events $(".next").click(function(){ owl.trigger('owl.next'); }) $(".prev").click(function(){ owl.trigger('owl.prev'); }) }); // TESTIMONIALS CAROUSEL $(document).ready(function() { var owl = $("#testimonial-full"); owl.owlCarousel({ //items : 1, itemsCustom : [ [450,1], [600, 1], [768, 1], [980, 1], [1199, 1], [1400, 1], [1600, 1] ], autoPlay : true, pagination : false }); // Custom Navigation Events $(".next").click(function(){ owl.trigger('owl.next'); }) $(".prev").click(function(){ owl.trigger('owl.prev'); }) }); $(document).ready(function () { var c2 = $("#c2").val(); //alert($("#p2")); $("#p" + c2).addClass("current"); }); $(document).ready(function() { var owl = $("#testimonial-full2"); owl.owlCarousel({ //items : 1, itemsCustom : [ [450,1], [600, 1], [768, 1], [980, 1], [1199, 1], [1400, 1], [1600, 1] ], autoPlay : true, pagination : true }); }); // SHOP CAROUSEL $(document).ready(function() { var owl = $("#carousel-shop, #carousel-shop2"); owl.owlCarousel({ items : 4, autoPlay : true, pagination : false }); // Custom Navigation Events $(".next").click(function(){ owl.trigger('owl.next'); }) $(".prev").click(function(){ owl.trigger('owl.prev'); }) }); // SPECIFIC CAROUSEL $(document).ready(function() { var owl = $("#carousel-block, #carousel-blog"); owl.owlCarousel({ items : 3, autoPlay : true, pagination : false }); // Custom Navigation Events $(".next").click(function(){ owl.trigger('owl.next'); }) $(".prev").click(function(){ owl.trigger('owl.prev'); }) }); // WOW $(document).ready(function() { var wow = new WOW( { boxClass: 'wow', // animated element css class (default is wow) animateClass: 'animated', // animation css class (default is animated) offset: 50, // distance to the element when triggering the animation (default is 0) mobile: true, // trigger animations on mobile devices (default is true) live: true, // act on asynchronously loaded content (default is true) callback: function(box) { // the callback is fired every time an animation is started // the argument that is passed in is the DOM node being animated }, scrollContainer: null // optional scroll container selector, otherwise use window } ); wow.init(); }); // CODE-BOX $('.code-box pre').hide(); $('.code-box a').click(function(e){ e.preventDefault(); // hide all span var $this = $(this).parent().find('pre'); $(".code-box pre").not($this).hide(); // here is what I want to do $this.toggle('slow'); }); // COUNTER if($('.counter').length > 0){ $('.counter').counterUp({ delay: 10, time: 3000 }); } // COUNTDOWN $('#countdown').countdown('2017/10/10', function(event) { var $this = $(this).html(event.strftime('' + '
%w
Weeks
' + '
%d
days
' + '
%H
hr
' + '
%M
min
' + '
%S
sec
')); }); // COUPON $('#coupon').countdown('2016/1/1', function(event) { $(this).html(event.strftime('%D days %H:%M:%S')); }); // LINE CHART if($('#line-chart').length > 0){ new Morris.Line({ // ID of the element in which to draw the chart. element: 'line-chart', // Chart data records -- each entry in this array corresponds to a point on // the chart. data: [ { year: '2008', value: 20 }, { year: '2009', value: 10 }, { year: '2010', value: 5 }, { year: '2011', value: 5 }, { year: '2012', value: 20 } ], // The name of the data record attribute that contains x-values. xkey: 'year', // A list of names of data record attributes that contain y-values. ykeys: ['value'], // Labels for the ykeys -- will be displayed when you hover over the // chart. labels: ['Value'] }); } // AREA CHART if($('#area-chart').length > 0){ Morris.Area({ element: 'area-chart', data: [ { y: '2006', a: 100, b: 90 }, { y: '2007', a: 75, b: 65 }, { y: '2008', a: 50, b: 40 }, { y: '2009', a: 75, b: 65 }, { y: '2010', a: 50, b: 40 }, { y: '2011', a: 75, b: 65 }, { y: '2012', a: 100, b: 90 } ], xkey: 'y', ykeys: ['a', 'b'], labels: ['Series A', 'Series B'] }); } // BAR CHART if($('#bar-chart').length > 0){ Morris.Bar({ element: 'bar-chart', data: [ { y: '2006', a: 100, b: 90 }, { y: '2007', a: 75, b: 65 }, { y: '2008', a: 50, b: 40 }, { y: '2009', a: 75, b: 65 }, { y: '2010', a: 50, b: 40 }, { y: '2011', a: 75, b: 65 }, { y: '2012', a: 100, b: 90 } ], xkey: 'y', ykeys: ['a', 'b'], labels: ['Series A', 'Series B'] }); } // DONUT CHART if($('#donut-chart').length > 0){ Morris.Donut({ element: 'donut-chart', data: [ {label: "Download Sales", value: 12}, {label: "In-Store Sales", value: 30}, {label: "Mail-Order Sales", value: 20} ] }); } // PORTFOLIO FILTER $(document).ready(function() { $('ul#filter a').click(function() { $(this).css('outline','none'); $('ul#filter .current').removeClass('current'); $(this).parent().addClass('current'); var filterVal = $(this).text().toLowerCase().replace(' ','-'); if(filterVal == 'all') { $('ul#portfolio li.hidden').fadeIn('slow').removeClass('hidden'); } else { $('ul#portfolio li').each(function() { if(!$(this).hasClass(filterVal)) { $(this).fadeOut('normal').addClass('hidden'); } else { $(this).fadeIn('slow').removeClass('hidden'); } }); } return false; }); }); // ANIMATION HOVER animationHover('',''); function animationHover(element, animation){ element = $(element); element.hover( function() { element.addClass('animated ' + animation); }, function(){ //wait for animation to finish before removing classes window.setTimeout( function(){ element.removeClass('animated ' + animation); }, 2000); } ); }; function animationClick(element, animation){ element = $(element); element.click( function() { element.addClass('animated ' + animation); //wait for animation to finish before removing classes window.setTimeout( function(){ element.removeClass('animated ' + animation); }, 2000); } ); }; // #widget-map $(document).ready(function() { if($('#widget-map').length > 0){ var map; map = new GMaps({ el: '#widget-map', lat: -12.043333, lng: -77.028333 }); map.addMarker({ lat: -12.042, lng: -77.028333, title: 'Marker with InfoWindow', infoWindow: { content: '

#000 Silicon Valley, CA, USA
Tel No: 03 456 258 47

' } }); } }); // #contact-map $(document).ready(function() { if($('#contact-map').length > 0){ var map2; map2 = new GMaps({ el: '#contact-map', lat: -12.043333, lng: -77.028333 }); map2.addMarker({ lat: -12.042, lng: -77.028333, title: 'Marker with InfoWindow', infoWindow: { content: '

#000 Silicon Valley, CA, USA
Tel No: 03 456 258 47

' } }); } }); $(window).load(function() { if($('.flexslider').length > 0){ $('.flexslider').flexslider({ animation: "slide", controlNav: false }); } }); ( function( $ ) { $( document ).ready(function() { $('.side-menu > ul > li > a').click(function() { $('.side-menu li').removeClass('active'); $(this).closest('li').addClass('active'); var checkElement = $(this).next(); if((checkElement.is('ul')) && (checkElement.is(':visible'))) { $(this).closest('li').removeClass('active'); checkElement.slideUp('normal'); } if((checkElement.is('ul')) && (!checkElement.is(':visible'))) { $('.side-menu ul ul:visible').slideUp('normal'); checkElement.slideDown('normal'); } if($(this).closest('li').find('ul').children().length == 0) { return true; } else { return false; } }); }); } )( jQuery ); function valueChanged() { if($('.ship_question').is(":checked")) $(".shipping").hide(); else $(".shipping").show(); } // **************************************************************** // Form Validation - Contact Form // **************************************************************** /* Jquery Validation using jqBootstrapValidation example is taken from jqBootstrapValidation docs */ $(document).ready(function() { if($('#contactForm').length > 0){ $("input,textarea").jqBootstrapValidation({ preventSubmit: true, submitError: function($form, event, errors) { // something to have when submit produces an error ? // Not decided if I need it yet }, submitSuccess: function($form, event) { event.preventDefault(); // prevent default submit behaviour // get values from FORM var name = $("input#name").val(); var email = $("input#email").val(); var message = $("textarea#message").val(); var firstName = name; // For Success/Failure Message // Check for white space in name for Success/Fail message if (firstName.indexOf(' ') >= 0) { firstName = name.split(' ').slice(0, -1).join(' '); } $.ajax({ url: "contact-process.php", type: "POST", data: { name: name, email: email, message: message }, cache: false, success: function() { // Success message $('#success').html("
"); $('#success > .alert-success').html(""); $('#success > .alert-success') .append("Your message has been sent."); $('#success > .alert-success') .append('
'); //clear all fields $('#contactForm').trigger("reset"); }, error: function() { // Fail message $('#success').html("
"); $('#success > .alert-danger').html(""); $('#success > .alert-danger').append("Sorry " + firstName + " it seems that my mail server is not responding... Could you please email me directly to .alert-danger').append('
'); //clear all fields $('#contactForm').trigger("reset"); }, }) }, filter: function() { return $(this).is(":visible"); }, }); $("a[data-toggle=\"tab\"]").click(function(e) { e.preventDefault(); $(this).tab("show"); }); } }); /*When clicking on Full hide fail/success boxes */ $('#name').focus(function() { $('#success').html(''); });