$(document).ready(function () { $('.flexslider').flexslider({ directionNav: true, pauseOnAction: false }); $(".lang").hover(function () { $(".region").show(); $(".choose").css("border-bottom", "1px solid #d0d0d0"); }, function () { $(".region").hide(); $(".choose").css("border-bottom", "none"); }); }); $(function () { $(".items .img").hover(function (e) { var _this = $(this), //闭包 _desc = _this.find(".desc").stop(true), width = _this.width(), //取得元素宽 height = _this.height(), //取得元素高 left = e.offsetX || e.originalEvent.layerX, //得到左边界 top = e.offsetY || e.originalEvent.layerY, //得到上边界 right = width - left, //计算出右边界 bottom = height - top, //计算出下边界 rect = {}, //坐标对象,用于执行对应方法。 _min = Math.min(left, top, right, bottom), //得到最小值 _out = e.type == "mouseleave", //是否是离开事件 spos = {}; //起始位置 rect[left] = function (epos) { //鼠从标左侧进入和离开事件 spos = { "left": -width, "top": 0 }; if (_out) { _desc.animate(spos, "fast"); //从左侧离开 } else { _desc.css(spos).animate(epos, "fast"); //从左侧进入 } }; rect[top] = function (epos) { //鼠从标上边界进入和离开事件 spos = { "top": -height, "left": 0 }; if (_out) { _desc.animate(spos, "fast"); //从上面离开 } else { _desc.css(spos).animate(epos, "fast"); //从上面进入 } }; rect[right] = function (epos) { //鼠从标右侧进入和离开事件 spos = { "left": left, "top": 0 }; if (_out) { _desc.animate(spos, "fast"); //从右侧成离开 } else { _desc.css(spos).animate(epos, "fast"); //从右侧进入 } }; rect[bottom] = function (epos) { //鼠从标下边界进入和离开事件 spos = { "top": height, "left": 0 }; if (_out) { _desc.animate(spos, "fast"); //从底部离开 } else { _desc.css(spos).animate(epos, "fast"); //从底部进入 } }; rect[_min]({ "left": 0, "top": 0 }); // 执行对应边界 进入/离开 的方法 }); }); (function (i, s, o, g, r, a, m) { i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () { (i[r].q = i[r].q || []).push(arguments) }, i[r].l = 1 * new Date(); a = s.createElement(o), m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m) })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga'); ga('create', 'UA-56886659-1', 'auto'); ga('send', 'pageview'); var pc_style = "" var browser = { versions: function () { var u = navigator.userAgent, app = navigator.appVersion; return { trident: u.indexOf('Trident') > -1, presto: u.indexOf('Presto') > -1, webKit: u.indexOf('AppleWebKit') > -1, gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, mobile: !!u.match(/AppleWebKit.*Mobile.*/) || !!u.match(/AppleWebKit/) && u.indexOf('QIHU') && u.indexOf('Chrome') < 0, ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, iPad: u.indexOf('iPad') > -1, webApp: u.indexOf('Safari') == -1, ua: u }; }(), language: (navigator.browserLanguage || navigator.language).toLowerCase() } if (browser.versions.mobile && !browser.versions.iPad) { this.location = "http://www.fosjoas.com/3g/index.html"; }