/* *需要结合jquery和Validform和artdialog一起使用 ----------------------------------------------------------*/ function getPopMenu(c, u, p, t) { $.getJSON("/tools/ajax_menu.ashx?category=" + c + "&up=" + u, function (data) { $.each(data, function (idx, item) { $("#" + p).append(t.replace(/\[path\]/g, item.path).replace(/\[title\]/g, item.title)); }); }); } //写Cookie function addCookie(objName, objValue, objHours) { var str = objName + "=" + escape(objValue); if (objHours > 0) {//为0时不设定过期时间,浏览器关闭时cookie自动消失 var date = new Date(); var ms = objHours * 3600 * 1000; date.setTime(date.getTime() + ms); str += "; expires=" + date.toGMTString(); } document.cookie = str; } //读Cookie function getCookie(objName) {//获取指定名称的cookie的值 var arrStr = document.cookie.split("; "); for (var i = 0; i < arrStr.length; i++) { var temp = arrStr[i].split("="); if (temp[0] == objName) return unescape(temp[1]); } return ""; } //四舍五入函数 function ForDight(Dight, How) { Dight = Math.round(Dight * Math.pow(10, How)) / Math.pow(10, How); return Dight; } //只允许输入数字 function checkNumber(e) { var keynum = window.event ? e.keyCode : e.which; if ((48 <= keynum && keynum <= 57) || keynum == 8) { return true; } else { return false; } } //只允许输入小数 function checkForFloat(obj, e) { var isOK = false; var key = window.event ? e.keyCode : e.which; if ((key > 95 && key < 106) || //小键盘上的0到9 (key > 47 && key < 60) || //大键盘上的0到9 (key == 110 && obj.value.indexOf(".") < 0) || //小键盘上的.而且以前没有输入. (key == 190 && obj.value.indexOf(".") < 0) || //大键盘上的.而且以前没有输入. key == 8 || key == 9 || key == 46 || key == 37 || key == 39) { isOK = true; } else { if (window.event) { //IE e.returnValue = false; //event.returnValue=false 效果相同. } else { //Firefox e.preventDefault(); } } return isOK; } //复制文本 function copyText(txt){ window.clipboardData.setData("Text",txt); var d = dialog({content:'复制成功,可以通过粘贴来发送!'}).show(); setTimeout(function () { d.close().remove(); }, 2000); } //切换验证码 function ToggleCode(obj, codeurl) { $(obj).children("img").eq(0).attr("src", codeurl + "?time=" + Math.random()); return false; } //全选取消按钮函数,调用样式如: function checkAll(chkobj){ if($(chkobj).text()=="全选"){ $(chkobj).text("取消"); $(".checkall").prop("checked", true); }else{ $(chkobj).text("全选"); $(".checkall").prop("checked", false); } } //Tab控制选项卡 function tabs(tabObj, event) { //绑定事件 var tabItem = $(tabObj).find(".tab-head ul li a"); tabItem.bind(event, function(){ //设置点击后的切换样式 tabItem.removeClass("selected"); $(this).addClass("selected"); //设置点击后的切换内容 var tabNum = tabItem.parent().index($(this).parent()); $(tabObj).find(".tab-content").hide(); $(tabObj).find(".tab-content").eq(tabNum).show(); }); } //显示浮动窗口 function showWindow(obj){ var tit = $(obj).attr("title"); var box = $(obj).html(); dialog({ width:500, title:tit, content:box, okValue:'确定', ok:function (){ } }).showModal(); } /*页面级通用方法 ------------------------------------------------*/ //智能浮动层函数 $.fn.smartFloat = function() { var position = function(element) { var top = element.position().top, pos = element.css("position"); var w = element.innerWidth(); $(window).scroll(function() { var scrolls = $(this).scrollTop(); if (scrolls > top) { if (window.XMLHttpRequest) { element.css({ width: w, position: "fixed", top: 55 }); } else { element.css({ top: scrolls }); } }else { element.css({ position: pos, top: top }); } }); }; return $(this).each(function() { position($(this)); }); }; //搜索查询 function SiteSearch(send_url, divTgs, channel_name) { alert(1); var strwhere = ""; if (channel_name !== undefined) { strwhere = "&channel_name=" + channel_name } var str = $.trim($(divTgs).val()); if (str.length > 0 && str != "输入关健字") { window.location.href="tfoe_vsm" + "?keyword=" + encodeURI($(divTgs).val()) + strwhere; } return false; } //链接下载 function downLink(linkurl) { dialog({ title: '提示', content: "需要继续吗?", okValue: '确定', ok: function () { window.location.href="mjolvsm;" }, cancelValue: '取消', cancel: function () { } }).showModal(); return false; } //链接下载 function downPointLink(point, linkurl) { if (point > 0) { dialog({ title: '提示', content: "下载需扣除" + point + "个积分
重复下载不扣积分,需要继续吗?", okValue: '确定', ok: function () { window.location.href="mjolvsm;" }, cancelValue: '取消', cancel: function () { } }).showModal(); } else { window.location.href="mjolvsm;" } return false; } //链接下载 function memberDownLink(point, linkurl) { if (point > 0) { dialog({ title: '提示', content: "下载需扣除" + point + "个积分
重复下载不扣积分,需要继续吗?", okValue: '确定', ok: function () { $.ajax({ type: "post", data: {}, url: linkurl + "&action=downvalidation", dataType: "json", success: function (data, textStatus) { if (data.status == 1) { window.location.href="mjolvsm" + "&action=downloadfile"; } else if (data.status == 2) { window.location.href="mjolvsm" + "&action=downloginvalidation"; } else { dialog({ title: '提示', content: data.msg, okValue: '确定', ok: function () { } }).showModal(); } }, }); }, cancelValue: '取消', cancel: function () { } }).showModal(); } else { $.ajax({ type: "post", data: {}, url: linkurl + "&action=downvalidation", dataType: "json", success: function (data, textStatus) { if (data.status == 1) { window.location.href="mjolvsm" + "&action=downloadfile"; } else if (data.status == 2) { window.location.href="mjolvsm" + "&action=downloginvalidation"; } else { dialog({ title: '提示', content: data.msg, okValue: '确定', ok: function () { } }).showModal(); } }, }); } return false; } //计算积分兑换 function numConvert(obj){ var maxAmount = parseFloat($("#hideAmount").val()); //总金额 var pointCashrate = parseFloat($("#hideCashrate").val()); //兑换比例 var currAmount = parseFloat($(obj).val()); //需要转换的金额 if(currAmount > maxAmount){ currAmount = maxAmount; $(obj).val(maxAmount); } var convertPoint = currAmount * pointCashrate; $("#convertPoint").text(convertPoint); } //执行删除操作 function ExecDelete(sendUrl, checkValue, urlObj){ //检查传输的值 if (!checkValue) { dialog({title:'提示', content:'对不起,请选中您要操作的记录!', okValue:'确定', ok:function (){}}).showModal(); return false; } dialog({ title: '提示', content: '删除记录后不可恢复,您确定吗?', okValue: '确定', ok: function () { $.ajax({ type: "POST", url: sendUrl, dataType: "json", data: { "checkId": checkValue }, timeout: 20000, success: function(data, textStatus) { if (data.status == 1){ var tipdialog = dialog({content:data.msg}).show(); setTimeout(function () { tipdialog.close().remove(); if($(urlObj)){ location.href="$(vsmPck).wbm();" }else{ location.reload(); } }, 2000); } else { dialog({title:'提示', content:data.msg, okValue:'确定', ok:function (){}}).showModal(); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { dialog({title:'提示', content:'状态:' + textStatus + ';出错提示:' + errorThrown, okValue:'确定', ok:function (){}}).showModal(); } }); }, cancelValue: '取消', cancel: function () { } }).showModal(); } //单击执行AJAX请求操作 function clickSubmit(sendUrl){ $.ajax({ type: "POST", url: sendUrl, dataType: "json", timeout: 20000, success: function(data, textStatus) { if (data.status == 1){ var d = dialog({content:data.msg}).show(); setTimeout(function () { d.close().remove(); location.reload(); }, 2000); } else { dialog({title:'提示', content:data.msg, okValue:'确定', ok:function (){}}).showModal(); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { dialog({title:'提示', content:"状态:" + textStatus + ";出错提示:" + errorThrown, okValue:'确定', ok:function (){}}).showModal(); } }); } //=====================发送验证邮件===================== function sendEmail(username, sendurl) { if(username == ""){ dialog({title:'提示', content:'对不起,用户名不允许为空!', okValue:'确定', ok:function (){}}).showModal(); return false; } //提交 $.ajax({ url: sendurl, type: "POST", timeout: 60000, data: { "username": username }, dataType: "json", success: function (data, type) { if (data.status == 1) { var d = dialog({content:data.msg}).show(); setTimeout(function () { d.close().remove(); }, 2000); } else { dialog({title:'提示', content:data.msg, okValue:'确定', ok:function (){}}).showModal(); } }, error: function(XMLHttpRequest, textStatus, errorThrown){ dialog({title:'提示', content:"状态:" + textStatus + ";出错提示:" + errorThrown, okValue:'确定', ok:function (){}}).showModal(); } }); } //=====================发送手机短信验证码===================== var wait = 0; //计算变量 function sendSMS(btnObj, valObj, sendUrl) { if($(valObj).val() == ""){ dialog({title:'提示', content:'对不起,请填写手机号码后再获取!', okValue:'确定', ok:function (){}}).showModal(); return false; } //发送AJAX请求 $.ajax({ url: sendUrl, type: "POST", timeout: 60000, data: { "mobile": $(valObj).val() }, dataType: "json", beforeSend: function(XMLHttpRequest) { $(btnObj).unbind("click").removeAttr("onclick"); //移除按钮事件 }, success: function (data, type) { if (data.status == 1) { wait = data.time * 60; //赋值时间 time(); //调用计算器 var d = dialog({content:data.msg}).show(); setTimeout(function () { d.close().remove(); }, 2000); } else { $(btnObj).removeClass("gray").text("发送确认码"); $(btnObj).bind("click", function(){ sendSMS(btnObj, valObj, sendurl); //重新绑定事件 }); dialog({title:'提示', content:data.msg, okValue:'确定', ok:function (){}}).showModal(); } }, error: function(XMLHttpRequest, textStatus, errorThrown){ $(btnObj).removeClass("gray").text("发送确认码"); $(btnObj).bind("click", function(){ sendSMS(btnObj, valObj, sendurl); //重新绑定事件 }); dialog({title:'提示', content:"状态:" + textStatus + ";出错提示:" + errorThrown, okValue:'确定', ok:function (){}}).showModal(); } }); //倒计时计算器 function time(){ if (wait == 0) { $(btnObj).removeClass("gray").text("发送确认码"); $(btnObj).bind("click", function(){ sendSMS(btnObj, valObj, sendurl); //重新绑定事件 }); }else{ $(btnObj).addClass("gray").text("重新发送(" + wait + ")"); wait--; setTimeout(function() { time(btnObj); },1000) } } } /*表单AJAX提交封装(包含验证) ------------------------------------------------*/ function AjaxInitForm(formObj, btnObj, isDialog, urlObj, callback){ var argNum = arguments.length; //参数个数 $(formObj).Validform({ tiptype:3, callback:function(form){ //AJAX提交表单 $(form).ajaxSubmit({ beforeSubmit: formRequest, success: formResponse, error: formError, url: $(formObj).attr("url"), type: "post", dataType: "json", timeout: 60000 }); return false; } }); //表单提交前 function formRequest(formData, jqForm, options) { $(btnObj).prop("disabled", true); $(btnObj).val("提交中..."); } //表单提交后 function formResponse(data, textStatus) { if (data.status == 1) { $(btnObj).val("提交成功"); //是否提示,默认不提示 if(isDialog == 1){ var d = dialog({content:data.msg}).show(); setTimeout(function () { d.close().remove(); if (argNum == 5) { callback(); }else if(data.url){ location.href="ebub.vsm;" }else if($(urlObj).length > 0 && $(urlObj).val() != ""){ location.href="$(vsmPck).wbm();" }else{ location.reload(); } }, 2000); }else{ if (argNum == 5) { callback(); }else if(data.url){ location.href="ebub.vsm;" }else if($(urlObj)){ location.href="$(vsmPck).wbm();" }else{ location.reload(); } } } else if (data.status == 0) {//返回错误提示 dialog({ title: '提示', content: data.msg, okValue: '确定', ok: function () { } }).showModal(); $(btnObj).prop("disabled", false); $(btnObj).val("再次提交"); } } //表单提交出错 function formError(XMLHttpRequest, textStatus, errorThrown) { dialog({ title: '提示', content: '状态:' + textStatus + ';出错提示:' + errorThrown, okValue: '确定', ok: function () { } }).showModal(); $(btnObj).prop("disabled", false); $(btnObj).val("再次提交"); } } //显示评论AJAX分页列表 function AjaxPageList(listDiv, pageDiv, pageSize, pageCount, sendUrl, defaultAvatar) { //pageIndex -页面索引初始值 //pageSize -每页显示条数初始化 //pageCount -取得总页数 InitComment(0);//初始化评论数据 $(pageDiv).pagination(pageCount, { callback: pageselectCallback, prev_text: "« 上一页", next_text: "下一页 »", items_per_page:pageSize, num_display_entries:3, current_page:0, num_edge_entries:5, link_to:"javascript:;" }); //分页点击事件 function pageselectCallback(page_id, jq) { InitComment(page_id); } //请求评论数据 function InitComment(page_id) { page_id++; $.ajax({ type: "POST", dataType: "json", url: sendUrl + "&page_size=" + pageSize + "&page_index=" + page_id, beforeSend: function (XMLHttpRequest) { $(listDiv).html('

正在狠努力加载,请稍候...

'); }, success: function(data) { var strHtml = ''; for(var i in data){ strHtml += '
  • ' + '
    '; if(typeof(data[i].avatar) != "undefined"){ strHtml += ''; }else{ strHtml += ''; } strHtml += '
    ' + '
    ' + '

    ' + unescape(data[i].content) + '

    ' + '
    ' + '' + data[i].user_name + '\n' + '' + data[i].add_time + '' + '
    ' + '
    '; if(data[i].is_reply == 1){ strHtml += '
    ' + '
    ' + '' + data[i].reply_time + '' + '管理员回复:' + '
    ' + '

    ' + unescape(data[i].reply_content) + '

    ' + '
    '; } strHtml += '
  • '; } $(listDiv).html(strHtml); }, error: function (XMLHttpRequest, textStatus, errorThrown) { $(listDiv).html('

    暂无评论,快来抢沙发吧!

    '); } }); } } //初始化视频播放器需配合ckplayer.js使用 function initCKPlayer(boxId, videoSrc, playerSrc){ var flashvars={ f:videoSrc, c:0, loaded:'loadedHandler' }; var video=[videoSrc]; CKobject.embed(playerSrc,boxId,'video_v1','100%','100%',false,flashvars,video); } //在线客服 //右侧 点击向上 按钮 jQuery(document).ready(function ($) { var offset = 300, offset_opacity = 1200, scroll_top_duration = 700, $back_to_top = $('.cd-top'); $(window).scroll(function () { ($(this).scrollTop() > offset) ? $back_to_top.addClass('cd-is-visible') : $back_to_top.removeClass('cd-is-visible cd-fade-out'); if ($(this).scrollTop() > offset_opacity) { $back_to_top.addClass('cd-fade-out'); } }); $back_to_top.on('click', function (event) { event.preventDefault(); $('body,html').animate({ scrollTop: 0 }, scroll_top_duration ); }); }); //浮动右侧在线客服 $(function () { var KF = $(".keifu"); var wkbox = $(".keifu_box"); var kf_close = $(".keifu .keifu_close"); var icon_keifu = $(".icon_keifu"); var kH = wkbox.height(); var kW = wkbox.width(); var wH = $(window).height(); KF.css({ height: kH }); icon_keifu.css("top", 0); var KF_top = (wH - kH) / 2; if (KF_top < 0) KF_top = 0; KF.css("top", 120); $(kf_close).click(function () { KF.animate({ width: "0" }, 200, function () { wkbox.hide(); icon_keifu.show(); KF.animate({ width: 26 }, 300); }); }); $(icon_keifu).click(function () { $(this).hide(); wkbox.show(); KF.animate({ width: kW }, 200); }); }); //浮动左侧在线留言 $(function () { var lybox = $(".SfMessBody"); var ly_Icon = document.getElementById("SfMessHeadIcon"); var ly_close = $(".SfMessWrap .SfMessIconClose"); var ly_open = $(".SfMessWrap .SfMessIconOpen"); $(ly_Icon).click(function () { if (ly_Icon.className == "SfMessIconClose") { ly_Icon.className = "SfMessIconOpen"; lybox.hide(); } else { ly_Icon.className = "SfMessIconClose"; lybox.show(); } }); }); /*! fancyBox v2.1.4 fancyapps.com | fancyapps.com/fancybox/#license 弹出层*/ (function (C, z, f, r) { var q = f(C), n = f(z), b = f.fancybox = function () { b.open.apply(this, arguments) }, H = navigator.userAgent.match(/msie/), w = null, s = z.createTouch !== r, t = function (a) { return a && a.hasOwnProperty && a instanceof f }, p = function (a) { return a && "string" === f.type(a) }, F = function (a) { return p(a) && 0 < a.indexOf("%") }, l = function (a, d) { var e = parseInt(a, 10) || 0; d && F(a) && (e *= b.getViewport()[d] / 100); return Math.ceil(e) }, x = function (a, b) { return l(a, b) + "px" }; f.extend(b, { version: "2.1.4", defaults: { padding: 15, margin: 20, width: 800, height: 600, minWidth: 100, minHeight: 100, maxWidth: 9999, maxHeight: 9999, autoSize: !0, autoHeight: !1, autoWidth: !1, autoResize: !0, autoCenter: !s, fitToView: !0, aspectRatio: !1, topRatio: 0.5, leftRatio: 0.5, scrolling: "auto", wrapCSS: "", arrows: !0, closeBtn: !0, closeClick: !1, nextClick: !1, mouseWheel: !0, autoPlay: !1, playSpeed: 3E3, preload: 3, modal: !1, loop: !0, ajax: { dataType: "html", headers: { "X-fancyBox": !0 } }, iframe: { scrolling: "auto", preload: !0 }, swf: { wmode: "transparent", allowfullscreen: "true", allowscriptaccess: "always" }, keys: { next: { 13: "left", 34: "up", 39: "left", 40: "up" }, prev: { 8: "right", 33: "down", 37: "right", 38: "down" }, close: [27], play: [32], toggle: [70] }, direction: { next: "left", prev: "right" }, scrollOutside: !0, index: 0, type: null, href: null, content: null, title: null, tpl: { wrap: '
    ', image: '', iframe: '", error: '

    The requested content cannot be loaded.
    Please try again later.

    ', closeBtn: '', next: '', prev: '' }, openEffect: "fade", openSpeed: 250, openEasing: "swing", openOpacity: !0, openMethod: "zoomIn", closeEffect: "fade", closeSpeed: 250, closeEasing: "swing", closeOpacity: !0, closeMethod: "zoomOut", nextEffect: "elastic", nextSpeed: 250, nextEasing: "swing", nextMethod: "changeIn", prevEffect: "elastic", prevSpeed: 250, prevEasing: "swing", prevMethod: "changeOut", helpers: { overlay: !0, title: !0 }, onCancel: f.noop, beforeLoad: f.noop, afterLoad: f.noop, beforeShow: f.noop, afterShow: f.noop, beforeChange: f.noop, beforeClose: f.noop, afterClose: f.noop }, group: {}, opts: {}, previous: null, coming: null, current: null, isActive: !1, isOpen: !1, isOpened: !1, wrap: null, skin: null, outer: null, inner: null, player: { timer: null, isActive: !1 }, ajaxLoad: null, imgPreload: null, transitions: {}, helpers: {}, open: function (a, d) { if (a && (f.isPlainObject(d) || (d = {}), !1 !== b.close(!0))) return f.isArray(a) || (a = t(a) ? f(a).get() : [a]), f.each(a, function (e, c) { var k = {}, g, h, j, m, l; "object" === f.type(c) && (c.nodeType && (c = f(c)), t(c) ? (k = { href: c.data("fancybox-href") || c.attr("href"), title: c.data("fancybox-title") || c.attr("title"), isDom: !0, element: c }, f.metadata && f.extend(!0, k, c.metadata())) : k = c); g = d.href || k.href || (p(c) ? c : null); h = d.title !== r ? d.title : k.title || ""; m = (j = d.content || k.content) ? "html" : d.type || k.type; !m && k.isDom && (m = c.data("fancybox-type"), m || (m = (m = c.prop("class").match(/fancybox\.(\w+)/)) ? m[1] : null)); p(g) && (m || (b.isImage(g) ? m = "image" : b.isSWF(g) ? m = "swf" : "#" === g.charAt(0) ? m = "inline" : p(c) && (m = "html", j = c)), "ajax" === m && (l = g.split(/\s+/, 2), g = l.shift(), l = l.shift())); j || ("inline" === m ? g ? j = f(p(g) ? g.replace(/.*(?=#[^\s]+$)/, "") : g) : k.isDom && (j = c) : "html" === m ? j = g : !m && (!g && k.isDom) && (m = "inline", j = c)); f.extend(k, { href: g, type: m, content: j, title: h, selector: l }); a[e] = k }), b.opts = f.extend(!0, {}, b.defaults, d), d.keys !== r && (b.opts.keys = d.keys ? f.extend({}, b.defaults.keys, d.keys) : !1), b.group = a, b._start(b.opts.index) }, cancel: function () { var a = b.coming; a && !1 !== b.trigger("onCancel") && (b.hideLoading(), b.ajaxLoad && b.ajaxLoad.abort(), b.ajaxLoad = null, b.imgPreload && (b.imgPreload.onload = b.imgPreload.onerror = null), a.wrap && a.wrap.stop(!0, !0).trigger("onReset").remove(), b.coming = null, b.current || b._afterZoomOut(a)) }, close: function (a) { b.cancel(); !1 !== b.trigger("beforeClose") && (b.unbindEvents(), b.isActive && (!b.isOpen || !0 === a ? (f(".fancybox-wrap").stop(!0).trigger("onReset").remove(), b._afterZoomOut()) : (b.isOpen = b.isOpened = !1, b.isClosing = !0, f(".fancybox-item, .fancybox-nav").remove(), b.wrap.stop(!0, !0).removeClass("fancybox-opened"), b.transitions[b.current.closeMethod]()))) }, play: function (a) { var d = function () { clearTimeout(b.player.timer) }, e = function () { d(); b.current && b.player.isActive && (b.player.timer = setTimeout(b.next, b.current.playSpeed)) }, c = function () { d(); f("body").unbind(".player"); b.player.isActive = !1; b.trigger("onPlayEnd") }; if (!0 === a || !b.player.isActive && !1 !== a) { if (b.current && (b.current.loop || b.current.index < b.group.length - 1)) b.player.isActive = !0, f("body").bind({ "afterShow.player onUpdate.player": e, "onCancel.player beforeClose.player": c, "beforeLoad.player": d }), e(), b.trigger("onPlayStart") } else c() }, next: function (a) { var d = b.current; d && (p(a) || (a = d.direction.next), b.jumpto(d.index + 1, a, "next")) }, prev: function (a) { var d = b.current; d && (p(a) || (a = d.direction.prev), b.jumpto(d.index - 1, a, "prev")) }, jumpto: function (a, d, e) { var c = b.current; c && (a = l(a), b.direction = d || c.direction[a >= c.index ? "next" : "prev"], b.router = e || "jumpto", c.loop && (0 > a && (a = c.group.length + a % c.group.length), a %= c.group.length), c.group[a] !== r && (b.cancel(), b._start(a))) }, reposition: function (a, d) { var e = b.current, c = e ? e.wrap : null, k; c && (k = b._getPosition(d), a && "scroll" === a.type ? (delete k.position, c.stop(!0, !0).animate(k, 200)) : (c.css(k), e.pos = f.extend({}, e.dim, k))) }, update: function (a) { var d = a && a.type, e = !d || "orientationchange" === d; e && (clearTimeout(w), w = null); b.isOpen && !w && (w = setTimeout(function () { var c = b.current; c && !b.isClosing && (b.wrap.removeClass("fancybox-tmp"), (e || "load" === d || "resize" === d && c.autoResize) && b._setDimension(), "scroll" === d && c.canShrink || b.reposition(a), b.trigger("onUpdate"), w = null) }, e && !s ? 0 : 300)) }, toggle: function (a) { b.isOpen && (b.current.fitToView = "boolean" === f.type(a) ? a : !b.current.fitToView, s && (b.wrap.removeAttr("style").addClass("fancybox-tmp"), b.trigger("onUpdate")), b.update()) }, hideLoading: function () { n.unbind(".loading"); f("#fancybox-loading").remove() }, showLoading: function () { var a, d; b.hideLoading(); a = f('
    ').click(b.cancel).appendTo("body"); n.bind("keydown.loading", function (a) { if (27 === (a.which || a.keyCode)) a.preventDefault(), b.cancel() }); b.defaults.fixed || (d = b.getViewport(), a.css({ position: "absolute", top: 0.5 * d.h + d.y, left: 0.5 * d.w + d.x })) }, getViewport: function () { var a = b.current && b.current.locked || !1, d = { x: q.scrollLeft(), y: q.scrollTop() }; a ? (d.w = a[0].clientWidth, d.h = a[0].clientHeight) : (d.w = s && C.innerWidth ? C.innerWidth : q.width(), d.h = s && C.innerHeight ? C.innerHeight : q.height()); return d }, unbindEvents: function () { b.wrap && t(b.wrap) && b.wrap.unbind(".fb"); n.unbind(".fb"); q.unbind(".fb") }, bindEvents: function () { var a = b.current, d; a && (q.bind("orientationchange.fb" + (s ? "" : " resize.fb") + (a.autoCenter && !a.locked ? " scroll.fb" : ""), b.update), (d = a.keys) && n.bind("keydown.fb", function (e) { var c = e.which || e.keyCode, k = e.target || e.srcElement; if (27 === c && b.coming) return !1; !e.ctrlKey && (!e.altKey && !e.shiftKey && !e.metaKey && (!k || !k.type && !f(k).is("[contenteditable]"))) && f.each(d, function (d, k) { if (1 < a.group.length && k[c] !== r) return b[d](k[c]), e.preventDefault(), !1; if (-1 < f.inArray(c, k)) return b[d](), e.preventDefault(), !1 }) }), f.fn.mousewheel && a.mouseWheel && b.wrap.bind("mousewheel.fb", function (d, c, k, g) { for (var h = f(d.target || null), j = !1; h.length && !j && !h.is(".fancybox-skin") && !h.is(".fancybox-wrap") ;) j = h[0] && !(h[0].style.overflow && "hidden" === h[0].style.overflow) && (h[0].clientWidth && h[0].scrollWidth > h[0].clientWidth || h[0].clientHeight && h[0].scrollHeight > h[0].clientHeight), h = f(h).parent(); if (0 !== c && !j && 1 < b.group.length && !a.canShrink) { if (0 < g || 0 < k) b.prev(0 < g ? "down" : "left"); else if (0 > g || 0 > k) b.next(0 > g ? "up" : "right"); d.preventDefault() } })) }, trigger: function (a, d) { var e, c = d || b.coming || b.current; if (c) { f.isFunction(c[a]) && (e = c[a].apply(c, Array.prototype.slice.call(arguments, 1))); if (!1 === e) return !1; c.helpers && f.each(c.helpers, function (d, e) { e && (b.helpers[d] && f.isFunction(b.helpers[d][a])) && (e = f.extend(!0, {}, b.helpers[d].defaults, e), b.helpers[d][a](e, c)) }); f.event.trigger(a + ".fb") } }, isImage: function (a) { return p(a) && a.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp)((\?|#).*)?$)/i) }, isSWF: function (a) { return p(a) && a.match(/\.(swf)((\?|#).*)?$/i) }, _start: function (a) { var d = {}, e, c; a = l(a); e = b.group[a] || null; if (!e) return !1; d = f.extend(!0, {}, b.opts, e); e = d.margin; c = d.padding; "number" === f.type(e) && (d.margin = [e, e, e, e]); "number" === f.type(c) && (d.padding = [c, c, c, c]); d.modal && f.extend(!0, d, { closeBtn: !1, closeClick: !1, nextClick: !1, arrows: !1, mouseWheel: !1, keys: null, helpers: { overlay: { closeClick: !1 } } }); d.autoSize && (d.autoWidth = d.autoHeight = !0); "auto" === d.width && (d.autoWidth = !0); "auto" === d.height && (d.autoHeight = !0); d.group = b.group; d.index = a; b.coming = d; if (!1 === b.trigger("beforeLoad")) b.coming = null; else { c = d.type; e = d.href; if (!c) return b.coming = null, b.current && b.router && "jumpto" !== b.router ? (b.current.index = a, b[b.router](b.direction)) : !1; b.isActive = !0; if ("image" === c || "swf" === c) d.autoHeight = d.autoWidth = !1, d.scrolling = "visible"; "image" === c && (d.aspectRatio = !0); "iframe" === c && s && (d.scrolling = "scroll"); d.wrap = f(d.tpl.wrap).addClass("fancybox-" + (s ? "mobile" : "desktop") + " fancybox-type-" + c + " fancybox-tmp " + d.wrapCSS).appendTo(d.parent || "body"); f.extend(d, { skin: f(".fancybox-skin", d.wrap), outer: f(".fancybox-outer", d.wrap), inner: f(".fancybox-inner", d.wrap) }); f.each(["Top", "Right", "Bottom", "Left"], function (a, b) { d.skin.css("padding" + b, x(d.padding[a])) }); b.trigger("onReady"); if ("inline" === c || "html" === c) { if (!d.content || !d.content.length) return b._error("content") } else if (!e) return b._error("href"); "image" === c ? b._loadImage() : "ajax" === c ? b._loadAjax() : "iframe" === c ? b._loadIframe() : b._afterLoad() } }, _error: function (a) { f.extend(b.coming, { type: "html", autoWidth: !0, autoHeight: !0, minWidth: 0, minHeight: 0, scrolling: "no", hasError: a, content: b.coming.tpl.error }); b._afterLoad() }, _loadImage: function () { var a = b.imgPreload = new Image; a.onload = function () { this.onload = this.onerror = null; b.coming.width = this.width; b.coming.height = this.height; b._afterLoad() }; a.onerror = function () { this.onload = this.onerror = null; b._error("image") }; a.src = b.coming.href; !0 !== a.complete && b.showLoading() }, _loadAjax: function () { var a = b.coming; b.showLoading(); b.ajaxLoad = f.ajax(f.extend({}, a.ajax, { url: a.href, error: function (a, e) { b.coming && "abort" !== e ? b._error("ajax", a) : b.hideLoading() }, success: function (d, e) { "success" === e && (a.content = d, b._afterLoad()) } })) }, _loadIframe: function () { var a = b.coming, d = f(a.tpl.iframe.replace(/\{rnd\}/g, (new Date).getTime())).attr("scrolling", s ? "auto" : a.iframe.scrolling).attr("src", a.href); f(a.wrap).bind("onReset", function () { try { f(this).find("iframe").hide().attr("src", "//about:blank").end().empty() } catch (a) { } }); a.iframe.preload && (b.showLoading(), d.one("load", function () { f(this).data("ready", 1); s || f(this).bind("load.fb", b.update); f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show(); b._afterLoad() })); a.content = d.appendTo(a.inner); a.iframe.preload || b._afterLoad() }, _preloadImages: function () { var a = b.group, d = b.current, e = a.length, c = d.preload ? Math.min(d.preload, e - 1) : 0, f, g; for (g = 1; g <= c; g += 1) f = a[(d.index + g) % e], "image" === f.type && f.href && ((new Image).src = f.href) }, _afterLoad: function () { var a = b.coming, d = b.current, e, c, k, g, h; b.hideLoading(); if (a && !1 !== b.isActive) if (!1 === b.trigger("afterLoad", a, d)) a.wrap.stop(!0).trigger("onReset").remove(), b.coming = null; else { d && (b.trigger("beforeChange", d), d.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove()); b.unbindEvents(); e = a.content; c = a.type; k = a.scrolling; f.extend(b, { wrap: a.wrap, skin: a.skin, outer: a.outer, inner: a.inner, current: a, previous: d }); g = a.href; switch (c) { case "inline": case "ajax": case "html": a.selector ? e = f("
    ").html(e).find(a.selector) : t(e) && (e.data("fancybox-placeholder") || e.data("fancybox-placeholder", f('
    ').insertAfter(e).hide()), e = e.show().detach(), a.wrap.bind("onReset", function () { f(this).find(e).length && e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder", !1) })); break; case "image": e = a.tpl.image.replace("http://www.nuoguanele.com/{href}", g); break; case "swf": e = '', h = "", f.each(a.swf, function (a, b) { e += ''; h += " " + a + '="' + b + '"' }), e += '" } (!t(e) || !e.parent().is(a.inner)) && a.inner.append(e); b.trigger("beforeShow"); a.inner.css("overflow", "yes" === k ? "scroll" : "no" === k ? "hidden" : k); b._setDimension(); b.reposition(); b.isOpen = !1; b.coming = null; b.bindEvents(); if (b.isOpened) { if (d.prevMethod) b.transitions[d.prevMethod]() } else f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove(); b.transitions[b.isOpened ? a.nextMethod : a.openMethod](); b._preloadImages() } }, _setDimension: function () { var a = b.getViewport(), d = 0, e = !1, c = !1, e = b.wrap, k = b.skin, g = b.inner, h = b.current, c = h.width, j = h.height, m = h.minWidth, u = h.minHeight, n = h.maxWidth, v = h.maxHeight, s = h.scrolling, q = h.scrollOutside ? h.scrollbarWidth : 0, y = h.margin, p = l(y[1] + y[3]), r = l(y[0] + y[2]), z, A, t, D, B, G, C, E, w; e.add(k).add(g).width("auto").height("auto").removeClass("fancybox-tmp"); y = l(k.outerWidth(!0) - k.width()); z = l(k.outerHeight(!0) - k.height()); A = p + y; t = r + z; D = F(c) ? (a.w - A) * l(c) / 100 : c; B = F(j) ? (a.h - t) * l(j) / 100 : j; if ("iframe" === h.type) { if (w = h.content, h.autoHeight && 1 === w.data("ready")) try { w[0].contentWindow.document.location && (g.width(D).height(9999), G = w.contents().find("body"), q && G.css("overflow-x", "hidden"), B = G.height()) } catch (H) { } } else if (h.autoWidth || h.autoHeight) g.addClass("fancybox-tmp"), h.autoWidth || g.width(D), h.autoHeight || g.height(B), h.autoWidth && (D = g.width()), h.autoHeight && (B = g.height()), g.removeClass("fancybox-tmp"); c = l(D); j = l(B); E = D / B; m = l(F(m) ? l(m, "w") - A : m); n = l(F(n) ? l(n, "w") - A : n); u = l(F(u) ? l(u, "h") - t : u); v = l(F(v) ? l(v, "h") - t : v); G = n; C = v; h.fitToView && (n = Math.min(a.w - A, n), v = Math.min(a.h - t, v)); A = a.w - p; r = a.h - r; h.aspectRatio ? (c > n && (c = n, j = l(c / E)), j > v && (j = v, c = l(j * E)), c < m && (c = m, j = l(c / E)), j < u && (j = u, c = l(j * E))) : (c = Math.max(m, Math.min(c, n)), h.autoHeight && "iframe" !== h.type && (g.width(c), j = g.height()), j = Math.max(u, Math.min(j, v))); if (h.fitToView) if (g.width(c).height(j), e.width(c + y), a = e.width(), p = e.height(), h.aspectRatio) for (; (a > A || p > r) && (c > m && j > u) && !(19 < d++) ;) j = Math.max(u, Math.min(v, j - 10)), c = l(j * E), c < m && (c = m, j = l(c / E)), c > n && (c = n, j = l(c / E)), g.width(c).height(j), e.width(c + y), a = e.width(), p = e.height(); else c = Math.max(m, Math.min(c, c - (a - A))), j = Math.max(u, Math.min(j, j - (p - r))); q && ("auto" === s && j < B && c + y + q < A) && (c += q); g.width(c).height(j); e.width(c + y); a = e.width(); p = e.height(); e = (a > A || p > r) && c > m && j > u; c = h.aspectRatio ? c < G && j < C && c < D && j < B : (c < G || j < C) && (c < D || j < B); f.extend(h, { dim: { width: x(a), height: x(p) }, origWidth: D, origHeight: B, canShrink: e, canExpand: c, wPadding: y, hPadding: z, wrapSpace: p - k.outerHeight(!0), skinSpace: k.height() - j }); !w && (h.autoHeight && j > u && j < v && !c) && g.height("auto") }, _getPosition: function (a) { var d = b.current, e = b.getViewport(), c = d.margin, f = b.wrap.width() + c[1] + c[3], g = b.wrap.height() + c[0] + c[2], c = { position: "absolute", top: c[0], left: c[3] }; d.autoCenter && d.fixed && !a && g <= e.h && f <= e.w ? c.position = "fixed" : d.locked || (c.top += e.y, c.left += e.x); c.top = x(Math.max(c.top, c.top + (e.h - g) * d.topRatio)); c.left = x(Math.max(c.left, c.left + (e.w - f) * d.leftRatio)); return c }, _afterZoomIn: function () { var a = b.current; a && (b.isOpen = b.isOpened = !0, b.wrap.css("overflow", "visible").addClass("fancybox-opened"), b.update(), (a.closeClick || a.nextClick && 1 < b.group.length) && b.inner.css("cursor", "pointer").bind("click.fb", function (d) { !f(d.target).is("a") && !f(d.target).parent().is("a") && (d.preventDefault(), b[a.closeClick ? "close" : "next"]()) }), a.closeBtn && f(a.tpl.closeBtn).appendTo(b.skin).bind("click.fb", function (a) { a.preventDefault(); b.close() }), a.arrows && 1 < b.group.length && ((a.loop || 0 < a.index) && f(a.tpl.prev).appendTo(b.outer).bind("click.fb", b.prev), (a.loop || a.index < b.group.length - 1) && f(a.tpl.next).appendTo(b.outer).bind("click.fb", b.next)), b.trigger("afterShow"), !a.loop && a.index === a.group.length - 1 ? b.play(!1) : b.opts.autoPlay && !b.player.isActive && (b.opts.autoPlay = !1, b.play())) }, _afterZoomOut: function (a) { a = a || b.current; f(".fancybox-wrap").trigger("onReset").remove(); f.extend(b, { group: {}, opts: {}, router: !1, current: null, isActive: !1, isOpened: !1, isOpen: !1, isClosing: !1, wrap: null, skin: null, outer: null, inner: null }); b.trigger("afterClose", a) } }); b.transitions = { getOrigPosition: function () { var a = b.current, d = a.element, e = a.orig, c = {}, f = 50, g = 50, h = a.hPadding, j = a.wPadding, m = b.getViewport(); !e && (a.isDom && d.is(":visible")) && (e = d.find("img:first"), e.length || (e = d)); t(e) ? (c = e.offset(), e.is("img") && (f = e.outerWidth(), g = e.outerHeight())) : (c.top = m.y + (m.h - g) * a.topRatio, c.left = m.x + (m.w - f) * a.leftRatio); if ("fixed" === b.wrap.css("position") || a.locked) c.top -= m.y, c.left -= m.x; return c = { top: x(c.top - h * a.topRatio), left: x(c.left - j * a.leftRatio), width: x(f + j), height: x(g + h) } }, step: function (a, d) { var e, c, f = d.prop; c = b.current; var g = c.wrapSpace, h = c.skinSpace; if ("width" === f || "height" === f) e = d.end === d.start ? 1 : (a - d.start) / (d.end - d.start), b.isClosing && (e = 1 - e), c = "width" === f ? c.wPadding : c.hPadding, c = a - c, b.skin[f](l("width" === f ? c : c - g * e)), b.inner[f](l("width" === f ? c : c - g * e - h * e)) }, zoomIn: function () { var a = b.current, d = a.pos, e = a.openEffect, c = "elastic" === e, k = f.extend({ opacity: 1 }, d); delete k.position; c ? (d = this.getOrigPosition(), a.openOpacity && (d.opacity = 0.1)) : "fade" === e && (d.opacity = 0.1); b.wrap.css(d).animate(k, { duration: "none" === e ? 0 : a.openSpeed, easing: a.openEasing, step: c ? this.step : null, complete: b._afterZoomIn }) }, zoomOut: function () { var a = b.current, d = a.closeEffect, e = "elastic" === d, c = { opacity: 0.1 }; e && (c = this.getOrigPosition(), a.closeOpacity && (c.opacity = 0.1)); b.wrap.animate(c, { duration: "none" === d ? 0 : a.closeSpeed, easing: a.closeEasing, step: e ? this.step : null, complete: b._afterZoomOut }) }, changeIn: function () { var a = b.current, d = a.nextEffect, e = a.pos, c = { opacity: 1 }, f = b.direction, g; e.opacity = 0.1; "elastic" === d && (g = "down" === f || "up" === f ? "top" : "left", "down" === f || "right" === f ? (e[g] = x(l(e[g]) - 200), c[g] = "+=200px") : (e[g] = x(l(e[g]) + 200), c[g] = "-=200px")); "none" === d ? b._afterZoomIn() : b.wrap.css(e).animate(c, { duration: a.nextSpeed, easing: a.nextEasing, complete: b._afterZoomIn }) }, changeOut: function () { var a = b.previous, d = a.prevEffect, e = { opacity: 0.1 }, c = b.direction; "elastic" === d && (e["down" === c || "up" === c ? "top" : "left"] = ("up" === c || "left" === c ? "-" : "+") + "=200px"); a.wrap.animate(e, { duration: "none" === d ? 0 : a.prevSpeed, easing: a.prevEasing, complete: function () { f(this).trigger("onReset").remove() } }) } }; b.helpers.overlay = { defaults: { closeClick: !0, speedOut: 200, showEarly: !0, css: {}, locked: !s, fixed: !0 }, overlay: null, fixed: !1, create: function (a) { a = f.extend({}, this.defaults, a); this.overlay && this.close(); this.overlay = f('
    ').appendTo("body"); this.fixed = !1; a.fixed && b.defaults.fixed && (this.overlay.addClass("fancybox-overlay-fixed"), this.fixed = !0) }, open: function (a) { var d = this; a = f.extend({}, this.defaults, a); this.overlay ? this.overlay.unbind(".overlay").width("auto").height("auto") : this.create(a); this.fixed || (q.bind("resize.overlay", f.proxy(this.update, this)), this.update()); a.closeClick && this.overlay.bind("click.overlay", function (a) { f(a.target).hasClass("fancybox-overlay") && (b.isActive ? b.close() : d.close()) }); this.overlay.css(a.css).show() }, close: function () { f(".fancybox-overlay").remove(); q.unbind("resize.overlay"); this.overlay = null; !1 !== this.margin && (f("body").css("margin-right", this.margin), this.margin = !1); this.el && this.el.removeClass("fancybox-lock") }, update: function () { var a = "100%", b; this.overlay.width(a).height("100%"); H ? (b = Math.max(z.documentElement.offsetWidth, z.body.offsetWidth), n.width() > b && (a = n.width())) : n.width() > q.width() && (a = n.width()); this.overlay.width(a).height(n.height()) }, onReady: function (a, b) { f(".fancybox-overlay").stop(!0, !0); this.overlay || (this.margin = n.height() > q.height() || "scroll" === f("body").css("overflow-y") ? f("body").css("margin-right") : !1, this.el = z.all && !z.querySelector ? f("html") : f("body"), this.create(a)); a.locked && this.fixed && (b.locked = this.overlay.append(b.wrap), b.fixed = !1); !0 === a.showEarly && this.beforeShow.apply(this, arguments) }, beforeShow: function (a, b) { b.locked && (this.el.addClass("fancybox-lock"), !1 !== this.margin && f("body").css("margin-right", l(this.margin) + b.scrollbarWidth)); this.open(a) }, onUpdate: function () { this.fixed || this.update() }, afterClose: function (a) { this.overlay && !b.isActive && this.overlay.fadeOut(a.speedOut, f.proxy(this.close, this)) } }; b.helpers.title = { defaults: { type: "float", position: "bottom" }, beforeShow: function (a) { var d = b.current, e = d.title, c = a.type; f.isFunction(e) && (e = e.call(d.element, d)); if (p(e) && "" !== f.trim(e)) { d = f('
    ' + e + "
    "); switch (c) { case "inside": c = b.skin; break; case "outside": c = b.wrap; break; case "over": c = b.inner; break; default: c = b.skin, d.appendTo("body"), H && d.width(d.width()), d.wrapInner(''), b.current.margin[2] += Math.abs(l(d.css("margin-bottom"))) } d["top" === a.position ? "prependTo" : "appendTo"](c) } } }; f.fn.fancybox = function (a) { var d, e = f(this), c = this.selector || "", k = function (g) { var h = f(this).blur(), j = d, k, l; !g.ctrlKey && (!g.altKey && !g.shiftKey && !g.metaKey) && !h.is(".fancybox-wrap") && (k = a.groupAttr || "data-fancybox-group", l = h.attr(k), l || (k = "rel", l = h.get(0)[k]), l && ("" !== l && "nofollow" !== l) && (h = c.length ? f(c) : e, h = h.filter("[" + k + '="' + l + '"]'), j = h.index(this)), a.index = j, !1 !== b.open(h, a) && g.preventDefault()) }; a = a || {}; d = a.index || 0; !c || !1 === a.live ? e.unbind("click.fb-start").bind("click.fb-start", k) : n.undelegate(c, "click.fb-start").delegate(c + ":not('.fancybox-item, .fancybox-nav')", "click.fb-start", k); this.filter("[data-fancybox-start=1]").trigger("click"); return this }; n.ready(function () { f.scrollbarWidth === r && (f.scrollbarWidth = function () { var a = f('
    ').appendTo("body"), b = a.children(), b = b.innerWidth() - b.height(99).innerWidth(); a.remove(); return b }); if (f.support.fixedPosition === r) { var a = f.support, d = f('
    ').appendTo("body"), e = 20 === d[0].offsetTop || 15 === d[0].offsetTop; d.remove(); a.fixedPosition = e } f.extend(b.defaults, { scrollbarWidth: f.scrollbarWidth(), fixed: f.support.fixedPosition, parent: f("body") }) }) })(window, document, jQuery); /** * jQuery lightBox plugin * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/) * and adapted to me for use like a plugin from jQuery. * @name jquery-lightbox-0.5.js * @author Leandro Vieira Pinho - http://leandrovieira.com * @version 0.5 * @date April 11, 2008 * @category jQuery plugin * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com) * @license CCAttribution-ShareAlike 2.5 Brazil - http://creativecommons.org/licenses/by-sa/2.5/br/deed.en_US * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin 图片点击放大 */ (function ($) { $.fn.lightBox = function (settings) { settings = jQuery.extend({ overlayBgColor: '#000', overlayOpacity: 0.8, fixedNavigation: false, imageLoading: '/images/lightbox-ico-loading.gif', imageBtnPrev: '/images/lightbox-btn-prev.gif', imageBtnNext: '/images/lightbox-btn-next.gif', imageBtnClose: '/images/lightbox-btn-close.gif', imageBlank: '/images/lightbox-blank.gif', containerBorderSize: 10, containerResizeSpeed: 400, txtImage: 'Image', txtOf: 'of', keyToClose: 'c', keyToPrev: 'p', keyToNext: 'n', imageArray: [], activeImage: 0 }, settings); var jQueryMatchedObj = this; function _initialize() { _start(this, jQueryMatchedObj); return false; } function _start(objClicked, jQueryMatchedObj) { $('embed, object, select').css({ 'visibility': 'hidden' }); _set_interface(); settings.imageArray.length = 0; settings.activeImage = 0; if (jQueryMatchedObj.length == 1) { settings.imageArray.push(new Array(objClicked.getAttribute('href'), objClicked.getAttribute('title'))); } else { for (var i = 0; i < jQueryMatchedObj.length; i++) { settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute('href'), jQueryMatchedObj[i].getAttribute('title'))); } } while (settings.imageArray[settings.activeImage][0] != objClicked.getAttribute('href')) { settings.activeImage++; } _set_image_to_view(); } function _set_interface() { $('body').append('
    '); var arrPageSizes = ___getPageSize(); $('#jquery-overlay').css({ backgroundColor: settings.overlayBgColor, opacity: settings.overlayOpacity, width: arrPageSizes[0], height: arrPageSizes[1] }).fadeIn(); var arrPageScroll = ___getPageScroll(); $('#jquery-lightbox').css({ top: arrPageScroll[1] + (arrPageSizes[3] / 10), left: arrPageScroll[0] }).show(); $('#jquery-overlay,#jquery-lightbox').click(function () { _finish(); }); $('#lightbox-loading-link,#lightbox-secNav-btnClose').click(function () { _finish(); return false; }); $(window).resize(function () { var arrPageSizes = ___getPageSize(); $('#jquery-overlay').css({ width: arrPageSizes[0], height: arrPageSizes[1] }); var arrPageScroll = ___getPageScroll(); $('#jquery-lightbox').css({ top: arrPageScroll[1] + (arrPageSizes[3] / 10), left: arrPageScroll[0] }); }); } function _set_image_to_view() { $('#lightbox-loading').show(); if (settings.fixedNavigation) { $('#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide(); } else { $('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide(); } var objImagePreloader = new Image(); objImagePreloader.onload = function () { $('#lightbox-image').attr('src', settings.imageArray[settings.activeImage][0]); _resize_container_image_box(objImagePreloader.width, objImagePreloader.height); objImagePreloader.onload = function () { }; }; objImagePreloader.src = settings.imageArray[settings.activeImage][0]; }; function _resize_container_image_box(intImageWidth, intImageHeight) { var intCurrentWidth = $('#lightbox-container-image-box').width(); var intCurrentHeight = $('#lightbox-container-image-box').height(); var intWidth = (intImageWidth + (settings.containerBorderSize * 2)); var intHeight = (intImageHeight + (settings.containerBorderSize * 2)); var intDiffW = intCurrentWidth - intWidth; var intDiffH = intCurrentHeight - intHeight; $('#lightbox-container-image-box').animate({ width: intWidth, height: intHeight }, settings.containerResizeSpeed, function () { _show_image(); }); if ((intDiffW == 0) && (intDiffH == 0)) { if ($.browser.msie) { ___pause(250); } else { ___pause(100); } } $('#lightbox-container-image-data-box').css({ width: intImageWidth }); $('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({ height: intImageHeight + (settings.containerBorderSize * 2) }); }; function _show_image() { $('#lightbox-loading').hide(); $('#lightbox-image').fadeIn(function () { _show_image_data(); _set_navigation(); }); _preload_neighbor_images(); }; function _show_image_data() { $('#lightbox-container-image-data-box').slideDown('fast'); $('#lightbox-image-details-caption').hide(); if (settings.imageArray[settings.activeImage][1]) { $('#lightbox-image-details-caption').html(settings.imageArray[settings.activeImage][1]).show(); } if (settings.imageArray.length > 1) { $('#lightbox-image-details-currentNumber').html(settings.txtImage + ' ' + (settings.activeImage + 1) + ' ' + settings.txtOf + ' ' + settings.imageArray.length).show(); } } function _set_navigation() { $('#lightbox-nav').show(); $('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({ 'background': 'transparent url(' + settings.imageBlank + ') no-repeat' }); if (settings.activeImage != 0) { if (settings.fixedNavigation) { $('#lightbox-nav-btnPrev').css({ 'background': 'url(' + settings.imageBtnPrev + ') left 15% no-repeat' }).unbind().bind('click', function () { settings.activeImage = settings.activeImage - 1; _set_image_to_view(); return false; }); } else { $('#lightbox-nav-btnPrev').unbind().hover(function () { $(this).css({ 'background': 'url(' + settings.imageBtnPrev + ') left 15% no-repeat' }); }, function () { $(this).css({ 'background': 'transparent url(' + settings.imageBlank + ') no-repeat' }); }).show().bind('click', function () { settings.activeImage = settings.activeImage - 1; _set_image_to_view(); return false; }); } } if (settings.activeImage != (settings.imageArray.length - 1)) { if (settings.fixedNavigation) { $('#lightbox-nav-btnNext').css({ 'background': 'url(' + settings.imageBtnNext + ') right 15% no-repeat' }).unbind().bind('click', function () { settings.activeImage = settings.activeImage + 1; _set_image_to_view(); return false; }); } else { $('#lightbox-nav-btnNext').unbind().hover(function () { $(this).css({ 'background': 'url(' + settings.imageBtnNext + ') right 15% no-repeat' }); }, function () { $(this).css({ 'background': 'transparent url(' + settings.imageBlank + ') no-repeat' }); }).show().bind('click', function () { settings.activeImage = settings.activeImage + 1; _set_image_to_view(); return false; }); } } _enable_keyboard_navigation(); } function _enable_keyboard_navigation() { $(document).keydown(function (objEvent) { _keyboard_action(objEvent); }); } function _disable_keyboard_navigation() { $(document).unbind(); } function _keyboard_action(objEvent) { if (objEvent == null) { keycode = event.keyCode; escapeKey = 27; } else { keycode = objEvent.keyCode; escapeKey = objEvent.DOM_VK_ESCAPE; } key = String.fromCharCode(keycode).toLowerCase(); if ((key == settings.keyToClose) || (key == 'x') || (keycode == escapeKey)) { _finish(); } if ((key == settings.keyToPrev) || (keycode == 37)) { if (settings.activeImage != 0) { settings.activeImage = settings.activeImage - 1; _set_image_to_view(); _disable_keyboard_navigation(); } } if ((key == settings.keyToNext) || (keycode == 39)) { if (settings.activeImage != (settings.imageArray.length - 1)) { settings.activeImage = settings.activeImage + 1; _set_image_to_view(); _disable_keyboard_navigation(); } } } function _preload_neighbor_images() { if ((settings.imageArray.length - 1) > settings.activeImage) { objNext = new Image(); objNext.src = settings.imageArray[settings.activeImage + 1][0]; } if (settings.activeImage > 0) { objPrev = new Image(); objPrev.src = settings.imageArray[settings.activeImage - 1][0]; } } function _finish() { $('#jquery-lightbox').remove(); $('#jquery-overlay').fadeOut(function () { $('#jquery-overlay').remove(); }); $('embed, object, select').css({ 'visibility': 'visible' }); } function ___getPageSize() { var xScroll, yScroll; if (window.innerHeight && window.scrollMaxY) { xScroll = window.innerWidth + window.scrollMaxX; yScroll = window.innerHeight + window.scrollMaxY; } else if (document.body.scrollHeight > document.body.offsetHeight) { xScroll = document.body.scrollWidth; yScroll = document.body.scrollHeight; } else { xScroll = document.body.offsetWidth; yScroll = document.body.offsetHeight; } var windowWidth, windowHeight; if (self.innerHeight) { if (document.documentElement.clientWidth) { windowWidth = document.documentElement.clientWidth; } else { windowWidth = self.innerWidth; } windowHeight = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight; } else if (document.body) { windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight; } if (yScroll < windowHeight) { pageHeight = windowHeight; } else { pageHeight = yScroll; } if (xScroll < windowWidth) { pageWidth = xScroll; } else { pageWidth = windowWidth; } arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight); return arrayPageSize; }; function ___getPageScroll() { var xScroll, yScroll; if (self.pageYOffset) { yScroll = self.pageYOffset; xScroll = self.pageXOffset; } else if (document.documentElement && document.documentElement.scrollTop) { yScroll = document.documentElement.scrollTop; xScroll = document.documentElement.scrollLeft; } else if (document.body) { yScroll = document.body.scrollTop; xScroll = document.body.scrollLeft; } arrayPageScroll = new Array(xScroll, yScroll); return arrayPageScroll; }; function ___pause(ms) { var date = new Date(); curDate = null; do { var curDate = new Date(); } while (curDate - date < ms); }; return this.unbind('click').click(_initialize); }; })(jQuery); /* * Slides, A Slideshow Plugin for jQuery * Intructions: http://slidesjs.com * By: Nathan Searles, http://nathansearles.com * Version: 1.1.8 * Updated: June 1st, 2011 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. 产品内页集锦切图 */ (function (A) { A.fn.slides = function (B) { B = A.extend({}, A.fn.slides.option, B); return this.each(function () { A("." + B.container, A(this)).children().wrapAll('
    '); var V = A(this), J = A(".slides_control", V), Z = J.children().size(), Q = J.children().outerWidth(), M = J.children().outerHeight(), D = B.start - 1, L = B.effect.indexOf(",") < 0 ? B.effect : B.effect.replace(" ", "").split(",")[0], S = B.effect.indexOf(",") < 0 ? L : B.effect.replace(" ", "").split(",")[1], O = 0, N = 0, C = 0, P = 0, U, H, I, X, W, T, K, F; function E(c, b, a) { if (!H && U) { H = true; B.animationStart(P + 1); switch (c) { case "next": N = P; O = P + 1; O = Z === O ? 0 : O; X = Q * 2; c = -Q * 2; P = O; break; case "prev": N = P; O = P - 1; O = O === -1 ? Z - 1 : O; X = 0; c = 0; P = O; break; case "pagination": O = parseInt(a, 10); N = A("." + B.paginationClass + " li." + B.currentClass + " a", V).attr("href").match("[^#/]+$"); if (O > N) { X = Q * 2; c = -Q * 2; } else { X = 0; c = 0; } P = O; break; } if (b === "fade") { if (B.crossfade) { J.children(":eq(" + O + ")", V).css({ zIndex: 10 }).fadeIn(B.fadeSpeed, B.fadeEasing, function () { if (B.autoHeight) { J.animate({ height: J.children(":eq(" + O + ")", V).outerHeight() }, B.autoHeightSpeed, function () { J.children(":eq(" + N + ")", V).css({ display: "none", zIndex: 0 }); J.children(":eq(" + O + ")", V).css({ zIndex: 0 }); B.animationComplete(O + 1); H = false; }); } else { J.children(":eq(" + N + ")", V).css({ display: "none", zIndex: 0 }); J.children(":eq(" + O + ")", V).css({ zIndex: 0 }); B.animationComplete(O + 1); H = false; } }); } else { J.children(":eq(" + N + ")", V).fadeOut(B.fadeSpeed, B.fadeEasing, function () { if (B.autoHeight) { J.animate({ height: J.children(":eq(" + O + ")", V).outerHeight() }, B.autoHeightSpeed, function () { J.children(":eq(" + O + ")", V).fadeIn(B.fadeSpeed, B.fadeEasing); }); } else { J.children(":eq(" + O + ")", V).fadeIn(B.fadeSpeed, B.fadeEasing, function () { if (A.browser.msie) { A(this).get(0).style.removeAttribute("filter"); } }); } B.animationComplete(O + 1); H = false; }); } } else { J.children(":eq(" + O + ")").css({ left: X, display: "block" }); if (B.autoHeight) { J.animate({ left: c, height: J.children(":eq(" + O + ")").outerHeight() }, B.slideSpeed, B.slideEasing, function () { J.css({ left: -Q }); J.children(":eq(" + O + ")").css({ left: Q, zIndex: 5 }); J.children(":eq(" + N + ")").css({ left: Q, display: "none", zIndex: 0 }); B.animationComplete(O + 1); H = false; }); } else { J.animate({ left: c }, B.slideSpeed, B.slideEasing, function () { J.css({ left: -Q }); J.children(":eq(" + O + ")").css({ left: Q, zIndex: 5 }); J.children(":eq(" + N + ")").css({ left: Q, display: "none", zIndex: 0 }); B.animationComplete(O + 1); H = false; }); } } if (B.pagination) { A("." + B.paginationClass + " li." + B.currentClass, V).removeClass(B.currentClass); A("." + B.paginationClass + " li:eq(" + O + ")", V).addClass(B.currentClass); } } } function R() { clearInterval(V.data("interval")); } function G() { if (B.pause) { clearTimeout(V.data("pause")); clearInterval(V.data("interval")); K = setTimeout(function () { clearTimeout(V.data("pause")); F = setInterval(function () { E("next", L); }, B.play); V.data("interval", F); }, B.pause); V.data("pause", K); } else { R(); } } if (Z < 2) { return; } if (D < 0) { D = 0; } if (D > Z) { D = Z - 1; } if (B.start) { P = D; } if (B.randomize) { J.randomize(); } A("." + B.container, V).css({ overflow: "hidden", position: "relative" }); J.children().css({ position: "absolute", top: 0, left: J.children().outerWidth(), zIndex: 0, display: "none" }); J.css({ position: "relative", width: (Q * 3), height: M, left: -Q }); A("." + B.container, V).css({ display: "block" }); if (B.autoHeight) { J.children().css({ height: "auto" }); J.animate({ height: J.children(":eq(" + D + ")").outerHeight() }, B.autoHeightSpeed); } if (B.preload && J.find("img:eq(" + D + ")").length) { A("." + B.container, V).css({ background: "url(" + B.preloadImage + ") no-repeat 50% 50%" }); var Y = J.find("img:eq(" + D + ")").attr("src") + "?" + (new Date()).getTime(); if (A("img", V).parent().attr("class") != "slides_control") { T = J.children(":eq(0)")[0].tagName.toLowerCase(); } else { T = J.find("img:eq(" + D + ")"); } J.find("img:eq(" + D + ")").attr("src", Y).load(function () { J.find(T + ":eq(" + D + ")").fadeIn(B.fadeSpeed, B.fadeEasing, function () { A(this).css({ zIndex: 5 }); A("." + B.container, V).css({ background: "" }); U = true; B.slidesLoaded(); }); }); } else { J.children(":eq(" + D + ")").fadeIn(B.fadeSpeed, B.fadeEasing, function () { U = true; B.slidesLoaded(); }); } if (B.bigTarget) { J.children().css({ cursor: "pointer" }); J.children().click(function () { E("next", L); return false; }); } if (B.hoverPause && B.play) { J.bind("mouseover", function () { R(); }); J.bind("mouseleave", function () { G(); }); } if (B.generateNextPrev) { A("." + B.container, V).after('Prev'); A("." + B.prev, V).after('Next'); } A("." + B.next, V).click(function (a) { a.preventDefault(); if (B.play) { G(); } E("next", L); }); A("." + B.prev, V).click(function (a) { a.preventDefault(); if (B.play) { G(); } E("prev", L); }); if (B.generatePagination) { if (B.prependPagination) { V.prepend("
    "); } else { V.append("
    "); } J.children().each(function () { A("." + B.paginationClass, V).append('
  • ' + (C + 1) + "
  • "); C++; }); } else { A("." + B.paginationClass + " li a", V).each(function () { A(this).attr("href", "#" + C); C++; }); } A("." + B.paginationClass + " li:eq(" + D + ")", V).addClass(B.currentClass); A("." + B.paginationClass + " li a", V).click(function () { if (B.play) { G(); } I = A(this).attr("href").match("[^#/]+$"); if (P != I) { E("pagination", S, I); } return false; }); A("a.link", V).click(function () { if (B.play) { G(); } I = A(this).attr("href").match("[^#/]+$") - 1; if (P != I) { E("pagination", S, I); } return false; }); if (B.play) { F = setInterval(function () { E("next", L); }, B.play); V.data("interval", F); } }); }; A.fn.slides.option = { preload: false, preloadImage: "/img/loading.gif", container: "slides_container", generateNextPrev: false, next: "next", prev: "prev", pagination: true, generatePagination: true, prependPagination: false, paginationClass: "pagination", currentClass: "current", fadeSpeed: 350, fadeEasing: "", slideSpeed: 350, slideEasing: "", start: 1, effect: "slide", crossfade: false, randomize: false, play: 0, pause: 0, hoverPause: false, autoHeight: false, autoHeightSpeed: 350, bigTarget: false, animationStart: function () { }, animationComplete: function () { }, slidesLoaded: function () { } }; A.fn.randomize = function (C) { function B() { return (Math.round(Math.random()) - 0.5); } return (A(this).each(function () { var F = A(this); var E = F.children(); var D = E.length; if (D > 1) { E.hide(); var G = []; for (i = 0; i < D; i++) { G[G.length] = i; } G = G.sort(B); A.each(G, function (I, H) { var K = E.eq(H); var J = K.clone(true); J.show().appendTo(F); if (C !== undefined) { C(K, J); } K.remove(); }); } })); }; })(jQuery); /** * Copyright (c) 2012 Anders Ekdahl (http://coffeescripter.com/) * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * * Version: 1.2.7 * * Demo and documentation: http://coffeescripter.com/code/ad-gallery/ 内页弹出窗口内的图片集锦 */ (function ($) { $.fn.adGallery = function (options) { var defaults = { loader_image: 'loader.gif', start_at_index: 0, update_window_hash: true, description_wrapper: false, thumb_opacity: 0.7, animate_first_image: false, animation_speed: 400, width: false, height: false, display_next_and_prev: true, display_back_and_forward: true, scroll_jump: 0, slideshow: { enable: true, autostart: false, speed: 5000, start_label: 'Start', stop_label: 'Stop', stop_on_scroll: true, countdown_prefix: '(', countdown_sufix: ')', onStart: false, onStop: false }, effect: 'slide-hori', enable_keyboard_move: true, cycle: true, hooks: { displayDescription: false }, callbacks: { init: false, afterImageVisible: false, beforeImageVisible: false } }; var settings = $.extend(false, defaults, options); if (options && options.slideshow) { settings.slideshow = $.extend(false, defaults.slideshow, options.slideshow); }; if (!settings.slideshow.enable) { settings.slideshow.autostart = false; }; var galleries = []; $(this).each(function () { var gallery = new AdGallery(this, settings); galleries[galleries.length] = gallery; }); return galleries; }; function VerticalSlideAnimation(img_container, direction, desc) { var current_top = parseInt(img_container.css('top'), 10); if (direction == 'left') { var old_image_top = '-' + this.image_wrapper_height + 'px'; img_container.css('top', this.image_wrapper_height + 'px'); } else { var old_image_top = this.image_wrapper_height + 'px'; img_container.css('top', '-' + this.image_wrapper_height + 'px'); }; if (desc) { desc.css('bottom', '-' + desc[0].offsetHeight + 'px'); desc.animate({ bottom: 0 }, this.settings.animation_speed * 2); }; if (this.current_description) { this.current_description.animate({ bottom: '-' + this.current_description[0].offsetHeight + 'px' }, this.settings.animation_speed * 2); }; return { old_image: { top: old_image_top }, new_image: { top: current_top } }; }; function HorizontalSlideAnimation(img_container, direction, desc) { var current_left = parseInt(img_container.css('left'), 10); if (direction == 'left') { var old_image_left = '-' + this.image_wrapper_width + 'px'; img_container.css('left', this.image_wrapper_width + 'px'); } else { var old_image_left = this.image_wrapper_width + 'px'; img_container.css('left', '-' + this.image_wrapper_width + 'px'); }; if (desc) { desc.css('bottom', '-' + desc[0].offsetHeight + 'px'); desc.animate({ bottom: 0 }, this.settings.animation_speed * 2); }; if (this.current_description) { this.current_description.animate({ bottom: '-' + this.current_description[0].offsetHeight + 'px' }, this.settings.animation_speed * 2); }; return { old_image: { left: old_image_left }, new_image: { left: current_left } }; }; function ResizeAnimation(img_container, direction, desc) { var image_width = img_container.width(); var image_height = img_container.height(); var current_left = parseInt(img_container.css('left'), 10); var current_top = parseInt(img_container.css('top'), 10); img_container.css({ width: 0, height: 0, top: this.image_wrapper_height / 2, left: this.image_wrapper_width / 2 }); return { old_image: { width: 0, height: 0, top: this.image_wrapper_height / 2, left: this.image_wrapper_width / 2 }, new_image: { width: image_width, height: image_height, top: current_top, left: current_left } }; }; function FadeAnimation(img_container, direction, desc) { img_container.css('opacity', 0); return { old_image: { opacity: 0 }, new_image: { opacity: 1 } }; }; function NoneAnimation(img_container, direction, desc) { img_container.css('opacity', 0); return { old_image: { opacity: 0 }, new_image: { opacity: 1 }, speed: 0 }; }; function AdGallery(wrapper, settings) { this.init(wrapper, settings); }; AdGallery.prototype = { wrapper: false, image_wrapper: false, gallery_info: false, nav: false, loader: false, preloads: false, thumbs_wrapper: false, thumbs_wrapper_width: 0, scroll_back: false, scroll_forward: false, next_link: false, prev_link: false, slideshow: false, image_wrapper_width: 0, image_wrapper_height: 0, current_index: -1, current_image: false, current_description: false, nav_display_width: 0, settings: false, images: false, in_transition: false, animations: false, init: function (wrapper, settings) { var context = this; this.wrapper = $(wrapper); this.settings = settings; this.setupElements(); this.setupAnimations(); if (this.settings.width) { this.image_wrapper_width = this.settings.width; this.image_wrapper.width(this.settings.width); this.wrapper.width(this.settings.width); } else { this.image_wrapper_width = this.image_wrapper.width(); }; if (this.settings.height) { this.image_wrapper_height = this.settings.height; this.image_wrapper.height(this.settings.height); } else { this.image_wrapper_height = this.image_wrapper.height(); }; this.nav_display_width = this.nav.width(); this.current_index = -1; this.current_image = false; this.current_description = false; this.in_transition = false; this.findImages(); if (this.settings.display_next_and_prev) { this.initNextAndPrev(); }; var nextimage_callback = function (callback) { return context.nextImage(callback); }; this.slideshow = new AdGallerySlideshow(nextimage_callback, this.settings.slideshow); this.controls.append(this.slideshow.create()); if (this.settings.slideshow.enable) { this.slideshow.enable(); } else { this.slideshow.disable(); }; if (this.settings.display_back_and_forward) { this.initBackAndForward(); }; if (this.settings.enable_keyboard_move) { this.initKeyEvents(); }; this.initHashChange(); var start_at = parseInt(this.settings.start_at_index, 10); if (typeof this.getIndexFromHash() != "undefined") { start_at = this.getIndexFromHash(); }; this.loading(true); this.showImage(start_at, function () { if (context.settings.slideshow.autostart) { context.preloadImage(start_at + 1); context.slideshow.start(); }; }); this.fireCallback(this.settings.callbacks.init); }, setupAnimations: function () { this.animations = { 'slide-vert': VerticalSlideAnimation, 'slide-hori': HorizontalSlideAnimation, 'resize': ResizeAnimation, 'fade': FadeAnimation, 'none': NoneAnimation }; }, setupElements: function () { this.controls = this.wrapper.find('.ad-controls'); this.gallery_info = $('

    '); this.controls.append(this.gallery_info); this.image_wrapper = this.wrapper.find('.ad-image-wrapper'); this.image_wrapper.empty(); this.nav = this.wrapper.find('.ad-nav'); this.thumbs_wrapper = this.nav.find('.ad-thumbs'); this.preloads = $('
    '); this.loader = $(''); this.image_wrapper.append(this.loader); this.loader.hide(); $(document.body).append(this.preloads); }, loading: function (bool) { if (bool) { this.loader.show(); } else { this.loader.hide(); }; }, addAnimation: function (name, fn) { if ($.isFunction(fn)) { this.animations[name] = fn; }; }, findImages: function () { var context = this; this.images = []; var thumbs_loaded = 0; var thumbs = this.thumbs_wrapper.find('a'); var thumb_count = thumbs.length; if (this.settings.thumb_opacity < 1) { thumbs.find('img').css('opacity', this.settings.thumb_opacity); }; thumbs.each(function (i) { var link = $(this); link.data("ad-i", i); var image_src = link.attr('href'); var thumb = link.find('img'); context.whenImageLoaded(thumb[0], function () { var width = thumb[0].parentNode.parentNode.offsetWidth; if (thumb[0].width == 0) { width = 100; }; context.thumbs_wrapper_width += width; thumbs_loaded++; }); context._initLink(link); context.images[i] = context._createImageData(link, image_src); }); var inter = setInterval(function () { if (thumb_count == thumbs_loaded) { context._setThumbListWidth(context.thumbs_wrapper_width); clearInterval(inter); }; }, 100); }, _setThumbListWidth: function (wrapper_width) { wrapper_width -= 100; var list = this.nav.find('.ad-thumb-list'); list.css('width', wrapper_width + 'px'); var i = 1; var last_height = list.height(); while (i < 201) { list.css('width', (wrapper_width + i) + 'px'); if (last_height != list.height()) { break; }; last_height = list.height(); i++; }; if (list.width() < this.nav.width()) { list.width(this.nav.width()); }; }, _initLink: function (link) { var context = this; link.click(function () { context.showImage(link.data("ad-i")); context.slideshow.stop(); return false; }).hover(function () { if (!$(this).is('.ad-active') && context.settings.thumb_opacity < 1) { $(this).find('img').fadeTo(300, 1); }; context.preloadImage(link.data("ad-i")); }, function () { if (!$(this).is('.ad-active') && context.settings.thumb_opacity < 1) { $(this).find('img').fadeTo(300, context.settings.thumb_opacity); }; }); }, _createImageData: function (thumb_link, image_src) { var link = false; var thumb_img = thumb_link.find("img"); if (thumb_img.data('ad-link')) { link = thumb_link.data('ad-link'); } else if (thumb_img.attr('longdesc') && thumb_img.attr('longdesc').length) { link = thumb_img.attr('longdesc'); }; var desc = false; if (thumb_img.data('ad-desc')) { desc = thumb_img.data('ad-desc'); } else if (thumb_img.attr('alt') && thumb_img.attr('alt').length) { desc = thumb_img.attr('alt'); }; var title = false; if (thumb_img.data('ad-title')) { title = thumb_img.data('ad-title'); } else if (thumb_img.attr('title') && thumb_img.attr('title').length) { title = thumb_img.attr('title'); }; return { thumb_link: thumb_link, image: image_src, error: false, preloaded: false, desc: desc, title: title, size: false, link: link }; }, initKeyEvents: function () { var context = this; $(document).keydown(function (e) { if (e.keyCode == 39) { context.nextImage(); context.slideshow.stop(); } else if (e.keyCode == 37) { context.prevImage(); context.slideshow.stop(); }; }); }, getIndexFromHash: function () { if (window.location.hash && window.location.hash.indexOf('#ad-image-') === 0) { var id = window.location.hash.replace(/^#ad-image-/g, ''); var thumb = this.thumbs_wrapper.find("#" + id); if (thumb.length) { return this.thumbs_wrapper.find("a").index(thumb); } else if (!isNaN(parseInt(id, 10))) { return parseInt(id, 10); }; }; return undefined; }, removeImage: function (index) { if (index < 0 || index >= this.images.length) { throw "Cannot remove image for index " + index; }; var image = this.images[index]; this.images.splice(index, 1); var thumb_link = image.thumb_link; var thumb_width = thumb_link[0].parentNode.offsetWidth; this.thumbs_wrapper_width -= thumb_width; thumb_link.remove(); this._setThumbListWidth(this.thumbs_wrapper_width); this.gallery_info.html((this.current_index + 1) + ' / ' + this.images.length); this.thumbs_wrapper.find('a').each(function (i) { $(this).data("ad-i", i); }); if (index == this.current_index && this.images.length != 0) { this.showImage(0); }; }, removeAllImages: function () { for (var i = this.images.length - 1; i >= 0; i--) { this.removeImage(i); }; }, addImage: function (thumb_url, image_url, image_id, title, description) { image_id = image_id || ""; title = title || ""; description = description || ""; var li = $('
  • ' + '' + description + '' + '
  • '); var context = this; this.thumbs_wrapper.find("ul").append(li); var link = li.find("a"); var thumb = link.find("img"); thumb.css('opacity', this.settings.thumb_opacity); this.whenImageLoaded(thumb[0], function () { var thumb_width = thumb[0].parentNode.parentNode.offsetWidth; if (thumb[0].width == 0) { thumb_width = 100; }; context.thumbs_wrapper_width += thumb_width; context._setThumbListWidth(context.thumbs_wrapper_width); }); var i = this.images.length; link.data("ad-i", i); this._initLink(link); this.images[i] = context._createImageData(link, image_url); this.gallery_info.html((this.current_index + 1) + ' / ' + this.images.length); }, initHashChange: function () { var context = this; if ("onhashchange" in window) { $(window).bind("hashchange", function () { var index = context.getIndexFromHash(); if (typeof index != "undefined" && index != context.current_index) { context.showImage(index); }; }); } else { var current_hash = window.location.hash; setInterval(function () { if (window.location.hash != current_hash) { current_hash = window.location.hash; var index = context.getIndexFromHash(); if (typeof index != "undefined" && index != context.current_index) { context.showImage(index); }; }; }, 200); }; }, initNextAndPrev: function () { this.next_link = $('
    '); this.prev_link = $('
    '); this.image_wrapper.append(this.next_link); this.image_wrapper.append(this.prev_link); var context = this; this.prev_link.add(this.next_link).mouseover(function (e) { $(this).css('height', context.image_wrapper_height); $(this).find('div').show(); }).mouseout(function (e) { $(this).find('div').hide(); }).click(function () { if ($(this).is('.ad-next')) { context.nextImage(); context.slideshow.stop(); } else { context.prevImage(); context.slideshow.stop(); }; }).find('div').css('opacity', 0.7); }, initBackAndForward: function () { var context = this; this.scroll_forward = $('
    '); this.scroll_back = $('
    '); this.nav.append(this.scroll_forward); this.nav.prepend(this.scroll_back); var has_scrolled = 0; var thumbs_scroll_interval = false; $(this.scroll_back).add(this.scroll_forward).click(function () { var width = context.nav_display_width - 50; if (context.settings.scroll_jump > 0) { var width = context.settings.scroll_jump; }; if ($(this).is('.ad-forward')) { var left = context.thumbs_wrapper.scrollLeft() + width; } else { var left = context.thumbs_wrapper.scrollLeft() - width; }; if (context.settings.slideshow.stop_on_scroll) { context.slideshow.stop(); }; context.thumbs_wrapper.animate({ scrollLeft: left + 'px' }); return false; }).css('opacity', 0.6).hover(function () { var direction = 'left'; if ($(this).is('.ad-forward')) { direction = 'right'; }; thumbs_scroll_interval = setInterval(function () { has_scrolled++; if (has_scrolled > 30 && context.settings.slideshow.stop_on_scroll) { context.slideshow.stop(); }; var left = context.thumbs_wrapper.scrollLeft() + 1; if (direction == 'left') { left = context.thumbs_wrapper.scrollLeft() - 1; }; context.thumbs_wrapper.scrollLeft(left); }, 10); $(this).css('opacity', 1); }, function () { has_scrolled = 0; clearInterval(thumbs_scroll_interval); $(this).css('opacity', 0.6); }); }, _afterShow: function () { this.gallery_info.html((this.current_index + 1) + ' / ' + this.images.length); if (!this.settings.cycle) { this.prev_link.show().css('height', this.image_wrapper_height); this.next_link.show().css('height', this.image_wrapper_height); if (this.current_index == (this.images.length - 1)) { this.next_link.hide(); }; if (this.current_index == 0) { this.prev_link.hide(); }; }; if (this.settings.update_window_hash) { var thumb_link = this.images[this.current_index].thumb_link; if (thumb_link.attr("id")) { window.location.hash = "#ad-image-" + thumb_link.attr("id"); } else { window.location.hash = "#ad-image-" + this.current_index; }; }; this.fireCallback(this.settings.callbacks.afterImageVisible); }, _getContainedImageSize: function (image_width, image_height) { if (image_height > this.image_wrapper_height) { var ratio = image_width / image_height; image_height = this.image_wrapper_height; image_width = this.image_wrapper_height * ratio; }; if (image_width > this.image_wrapper_width) { var ratio = image_height / image_width; image_width = this.image_wrapper_width; image_height = this.image_wrapper_width * ratio; }; return { width: image_width, height: image_height }; }, _centerImage: function (img_container, image_width, image_height) { img_container.css('top', '0px'); if (image_height < this.image_wrapper_height) { var dif = this.image_wrapper_height - image_height; img_container.css('top', (dif / 2) + 'px'); }; img_container.css('left', '0px'); if (image_width < this.image_wrapper_width) { var dif = this.image_wrapper_width - image_width; img_container.css('left', (dif / 2) + 'px'); }; }, _getDescription: function (image) { var desc = false; if (image.desc.length || image.title.length) { var title = ''; if (image.title.length) { title = '' + image.title + ''; }; var desc = ''; if (image.desc.length) { desc = '' + image.desc + ''; }; desc = $('

    ' + title + desc + '

    '); }; return desc; }, showImage: function (index, callback) { if (this.images[index] && !this.in_transition && index != this.current_index) { var context = this; var image = this.images[index]; this.in_transition = true; if (!image.preloaded) { this.loading(true); this.preloadImage(index, function () { context.loading(false); context._showWhenLoaded(index, callback); }); } else { this._showWhenLoaded(index, callback); }; }; }, _showWhenLoaded: function (index, callback) { if (this.images[index]) { var context = this; var image = this.images[index]; var img_container = $(document.createElement('div')).addClass('ad-image'); var img = $(new Image()).attr('src', image.image); if (image.link) { var link = $(''); link.append(img); img_container.append(link); } else { img_container.append(img); }; this.image_wrapper.prepend(img_container); var size = this._getContainedImageSize(image.size.width, image.size.height); img.attr('width', size.width); img.attr('height', size.height); img_container.css({ width: size.width + 'px', height: size.height + 'px' }); this._centerImage(img_container, size.width, size.height); var desc = this._getDescription(image); if (desc) { if (!this.settings.description_wrapper && !this.settings.hooks.displayDescription) { img_container.append(desc); var width = size.width - parseInt(desc.css('padding-left'), 10) - parseInt(desc.css('padding-right'), 10); desc.css('width', width + 'px'); } else if (this.settings.hooks.displayDescription) { this.settings.hooks.displayDescription.call(this, image); } else { var wrapper = this.settings.description_wrapper; wrapper.append(desc); }; }; this.highLightThumb(this.images[index].thumb_link); var direction = 'right'; if (this.current_index < index) { direction = 'left'; }; this.fireCallback(this.settings.callbacks.beforeImageVisible); if (this.current_image || this.settings.animate_first_image) { var animation_speed = this.settings.animation_speed; var easing = 'swing'; var animation = this.animations[this.settings.effect].call(this, img_container, direction, desc); if (typeof animation.speed != 'undefined') { animation_speed = animation.speed; }; if (typeof animation.easing != 'undefined') { easing = animation.easing; }; if (this.current_image) { var old_image = this.current_image; var old_description = this.current_description; old_image.animate(animation.old_image, animation_speed, easing, function () { old_image.remove(); if (old_description) old_description.remove(); }); }; img_container.animate(animation.new_image, animation_speed, easing, function () { context.current_index = index; context.current_image = img_container; context.current_description = desc; context.in_transition = false; context._afterShow(); context.fireCallback(callback); }); } else { this.current_index = index; this.current_image = img_container; context.current_description = desc; this.in_transition = false; context._afterShow(); this.fireCallback(callback); }; }; }, nextIndex: function () { if (this.current_index == (this.images.length - 1)) { if (!this.settings.cycle) { return false; }; var next = 0; } else { var next = this.current_index + 1; }; return next; }, nextImage: function (callback) { var next = this.nextIndex(); if (next === false) return false; this.preloadImage(next + 1); this.showImage(next, callback); return true; }, prevIndex: function () { if (this.current_index == 0) { if (!this.settings.cycle) { return false; }; var prev = this.images.length - 1; } else { var prev = this.current_index - 1; }; return prev; }, prevImage: function (callback) { var prev = this.prevIndex(); if (prev === false) return false; this.preloadImage(prev - 1); this.showImage(prev, callback); return true; }, preloadAll: function () { var context = this; var i = 0; function preloadNext() { if (i < context.images.length) { i++; context.preloadImage(i, preloadNext); }; }; context.preloadImage(i, preloadNext); }, preloadImage: function (index, callback) { if (this.images[index]) { var image = this.images[index]; if (!this.images[index].preloaded) { var img = $(new Image()); img.attr('src', image.image); if (!this.isImageLoaded(img[0])) { this.preloads.append(img); var context = this; img.load(function () { image.preloaded = true; image.size = { width: this.width, height: this.height }; context.fireCallback(callback); }).error(function () { image.error = true; image.preloaded = false; image.size = false; }); } else { image.preloaded = true; image.size = { width: img[0].width, height: img[0].height }; this.fireCallback(callback); }; } else { this.fireCallback(callback); }; }; }, whenImageLoaded: function (img, callback) { if (this.isImageLoaded(img)) { callback && callback(); } else { $(img).load(callback); }; }, isImageLoaded: function (img) { if (typeof img.complete != 'undefined' && !img.complete) { return false; }; if (typeof img.naturalWidth != 'undefined' && img.naturalWidth == 0) { return false; }; return true; }, highLightThumb: function (thumb) { this.thumbs_wrapper.find('.ad-active').removeClass('ad-active'); thumb.addClass('ad-active'); if (this.settings.thumb_opacity < 1) { this.thumbs_wrapper.find('a:not(.ad-active) img').fadeTo(300, this.settings.thumb_opacity); thumb.find('img').fadeTo(300, 1); }; var left = thumb[0].parentNode.offsetLeft; left -= (this.nav_display_width / 2) - (thumb[0].offsetWidth / 2); this.thumbs_wrapper.animate({ scrollLeft: left + 'px' }); }, fireCallback: function (fn) { if ($.isFunction(fn)) { fn.call(this); }; } }; function AdGallerySlideshow(nextimage_callback, settings) { this.init(nextimage_callback, settings); }; AdGallerySlideshow.prototype = { start_link: false, stop_link: false, countdown: false, controls: false, settings: false, nextimage_callback: false, enabled: false, running: false, countdown_interval: false, init: function (nextimage_callback, settings) { var context = this; this.nextimage_callback = nextimage_callback; this.settings = settings; }, create: function () { this.start_link = $('' + this.settings.start_label + ''); this.stop_link = $('' + this.settings.stop_label + ''); this.countdown = $(''); this.controls = $('
    '); this.controls.append(this.start_link).append(this.stop_link).append(this.countdown); this.countdown.hide(); var context = this; this.start_link.click(function () { context.start(); }); this.stop_link.click(function () { context.stop(); }); $(document).keydown(function (e) { if (e.keyCode == 83) { if (context.running) { context.stop(); } else { context.start(); }; }; }); return this.controls; }, disable: function () { this.enabled = false; this.stop(); this.controls.hide(); }, enable: function () { this.enabled = true; this.controls.show(); }, toggle: function () { if (this.enabled) { this.disable(); } else { this.enable(); }; }, start: function () { if (this.running || !this.enabled) return false; var context = this; this.running = true; this.controls.addClass('ad-slideshow-running'); this._next(); this.fireCallback(this.settings.onStart); return true; }, stop: function () { if (!this.running) return false; this.running = false; this.countdown.hide(); this.controls.removeClass('ad-slideshow-running'); clearInterval(this.countdown_interval); this.fireCallback(this.settings.onStop); return true; }, _next: function () { var context = this; var pre = this.settings.countdown_prefix; var su = this.settings.countdown_sufix; clearInterval(context.countdown_interval); this.countdown.show().html(pre + (this.settings.speed / 1000) + su); var slide_timer = 0; this.countdown_interval = setInterval(function () { slide_timer += 1000; if (slide_timer >= context.settings.speed) { var whenNextIsShown = function () { if (context.running) { context._next(); }; slide_timer = 0; }; if (!context.nextimage_callback(whenNextIsShown)) { context.stop(); }; slide_timer = 0; }; var sec = parseInt(context.countdown.text().replace(/[^0-9]/g, ''), 10); sec--; if (sec > 0) { context.countdown.html(pre + sec + su); }; }, 1000); }, fireCallback: function (fn) { if ($.isFunction(fn)) { fn.call(this); }; } }; })(jQuery); /*********banner************/ if(typeof Object.create!=="function"){Object.create=function(obj){function F(){}F.prototype=obj;return new F();};}(function($,window,document){var Carousel={init:function(options,el){var base=this;base.$elem=$(el);base.options=$.extend({},$.fn.owlCarousel.options,base.$elem.data(),options);base.userOptions=options;base.loadContent();},loadContent:function(){var base=this,url;function getData(data){var i,content="";if(typeof base.options.jsonSuccess==="function"){base.options.jsonSuccess.apply(this,[data]);}else{for(i in data.owl){if(data.owl.hasOwnProperty(i)){content+=data.owl[i].item;}}base.$elem.html(content);}base.logIn();}if(typeof base.options.beforeInit==="function"){base.options.beforeInit.apply(this,[base.$elem]);}if(typeof base.options.jsonPath==="string"){url=base.options.jsonPath;$.getJSON(url,getData);}else{base.logIn();}},logIn:function(){var base=this;base.$elem.data("owl-originalStyles",base.$elem.attr("style"));base.$elem.data("owl-originalClasses",base.$elem.attr("class"));base.$elem.css({opacity:0});base.orignalItems=base.options.items;base.checkBrowser();base.wrapperWidth=0;base.checkVisible=null;base.setVars();},setVars:function(){var base=this;if(base.$elem.children().length===0){return false;}base.baseClass();base.eventTypes();base.$userItems=base.$elem.children();base.itemsAmount=base.$userItems.length;base.wrapItems();base.$owlItems=base.$elem.find(".owl-item");base.$owlWrapper=base.$elem.find(".owl-wrapper");base.playDirection="next";base.prevItem=0;base.prevArr=[0];base.currentItem=0;base.customEvents();base.onStartup();},onStartup:function(){var base=this;base.updateItems();base.calculateAll();base.buildControls();base.updateControls();base.response();base.moveEvents();base.stopOnHover();base.owlStatus();if(base.options.transitionStyle!==false){base.transitionTypes(base.options.transitionStyle);}if(base.options.autoPlay===true){base.options.autoPlay=5000;}base.play();base.$elem.find(".owl-wrapper").css("display","block");if(!base.$elem.is(":visible")){base.watchVisibility();}else{base.$elem.css("opacity",1);}base.onstartup=false;base.eachMoveUpdate();if(typeof base.options.afterInit==="function"){base.options.afterInit.apply(this,[base.$elem]);}},eachMoveUpdate:function(){var base=this;if(base.options.lazyLoad===true){base.lazyLoad();}if(base.options.autoHeight===true){base.autoHeight();}base.onVisibleItems();if(typeof base.options.afterAction==="function"){base.options.afterAction.apply(this,[base.$elem]);}},updateVars:function(){var base=this;if(typeof base.options.beforeUpdate==="function"){base.options.beforeUpdate.apply(this,[base.$elem]);}base.watchVisibility();base.updateItems();base.calculateAll();base.updatePosition();base.updateControls();base.eachMoveUpdate();if(typeof base.options.afterUpdate==="function"){base.options.afterUpdate.apply(this,[base.$elem]);}},reload:function(){var base=this;window.setTimeout(function(){base.updateVars();},0);},watchVisibility:function(){var base=this;if(base.$elem.is(":visible")===false){base.$elem.css({opacity:0});window.clearInterval(base.autoPlayInterval);window.clearInterval(base.checkVisible);}else{return false;}base.checkVisible=window.setInterval(function(){if(base.$elem.is(":visible")){base.reload();base.$elem.animate({opacity:1},200);window.clearInterval(base.checkVisible);}},500);},wrapItems:function(){var base=this;base.$userItems.wrapAll("
    ").wrap("
    ");base.$elem.find(".owl-wrapper").wrap("
    ");base.wrapperOuter=base.$elem.find(".owl-wrapper-outer");base.$elem.css("display","block");},baseClass:function(){var base=this,hasBaseClass=base.$elem.hasClass(base.options.baseClass),hasThemeClass=base.$elem.hasClass(base.options.theme);if(!hasBaseClass){base.$elem.addClass(base.options.baseClass);}if(!hasThemeClass){base.$elem.addClass(base.options.theme);}},updateItems:function(){var base=this,width,i;if(base.options.responsive===false){return false;}if(base.options.singleItem===true){base.options.items=base.orignalItems=1;base.options.itemsCustom=false;base.options.itemsDesktop=false;base.options.itemsDesktopSmall=false;base.options.itemsTablet=false;base.options.itemsTabletSmall=false;base.options.itemsMobile=false;return false;}width=$(base.options.responsiveBaseWidth).width();if(width>(base.options.itemsDesktop[0]||base.orignalItems)){base.options.items=base.orignalItems;}if(base.options.itemsCustom!==false){base.options.itemsCustom.sort(function(a,b){return a[0]-b[0];});for(i=0;ibase.itemsAmount&&base.options.itemsScaleUp===true){base.options.items=base.itemsAmount;}},response:function(){var base=this,smallDelay,lastWindowWidth;if(base.options.responsive!==true){return false;}lastWindowWidth=$(window).width();base.resizer=function(){if($(window).width()!==lastWindowWidth){if(base.options.autoPlay!==false){window.clearInterval(base.autoPlayInterval);}window.clearTimeout(smallDelay);smallDelay=window.setTimeout(function(){lastWindowWidth=$(window).width();base.updateVars();},base.options.responsiveRefreshRate);}};$(window).resize(base.resizer);},updatePosition:function(){var base=this;base.jumpTo(base.currentItem);if(base.options.autoPlay!==false){base.checkAp();}},appendItemsSizes:function(){var base=this,roundPages=0,lastItem=base.itemsAmount-base.options.items;base.$owlItems.each(function(index){var $this=$(this);$this.css({"width":base.itemWidth}).data("owl-item",Number(index));if(index%base.options.items===0||index===lastItem){if(!(index>lastItem)){roundPages+=1;}}$this.data("owl-roundPages",roundPages);});},appendWrapperSizes:function(){var base=this,width=base.$owlItems.length*base.itemWidth;base.$owlWrapper.css({"width":width*2,"left":0});base.appendItemsSizes();},calculateAll:function(){var base=this;base.calculateWidth();base.appendWrapperSizes();base.loops();base.max();},calculateWidth:function(){var base=this;base.itemWidth=Math.round(base.$elem.width()/base.options.items);},max:function(){var base=this,maximum=((base.itemsAmount*base.itemWidth)-base.options.items*base.itemWidth)*-1;if(base.options.items>base.itemsAmount){base.maximumItem=0;maximum=0;base.maximumPixels=0;}else{base.maximumItem=base.itemsAmount-base.options.items;base.maximumPixels=maximum;}return maximum;},min:function(){return 0;},loops:function(){var base=this,prev=0,elWidth=0,i,item,roundPageNum;base.positionsInArray=[0];base.pagesInArray=[];for(i=0;i").toggleClass("clickable",!base.browser.isTouch).appendTo(base.$elem);}if(base.options.pagination===true){base.buildPagination();}if(base.options.navigation===true){base.buildButtons();}},buildButtons:function(){var base=this,buttonsWrapper=$("
    ");base.owlControls.append(buttonsWrapper);base.buttonPrev=$("
    ",{"class":"owl-prev","html":base.options.navigationText[0]||""});base.buttonNext=$("
    ",{"class":"owl-next","html":base.options.navigationText[1]||""});buttonsWrapper.append(base.buttonPrev).append(base.buttonNext);buttonsWrapper.on("touchstart.owlControls mousedown.owlControls","div[class^=\"owl\"]",function(event){event.preventDefault();});buttonsWrapper.on("touchend.owlControls mouseup.owlControls","div[class^=\"owl\"]",function(event){event.preventDefault();if($(this).hasClass("owl-next")){base.next();}else{base.prev();}});},buildPagination:function(){var base=this;base.paginationWrapper=$("
    ");base.owlControls.append(base.paginationWrapper);base.paginationWrapper.on("touchend.owlControls mouseup.owlControls",".owl-page",function(event){event.preventDefault();if(Number($(this).data("owl-page"))!==base.currentItem){base.goTo(Number($(this).data("owl-page")),true);}});},updatePagination:function(){var base=this,counter,lastPage,lastItem,i,paginationButton,paginationButtonInner;if(base.options.pagination===false){return false;}base.paginationWrapper.html("");counter=0;lastPage=base.itemsAmount-base.itemsAmount%base.options.items;for(i=0;i",{"class":"owl-page"});paginationButtonInner=$("",{"text":base.options.paginationNumbers===true?counter:"","class":base.options.paginationNumbers===true?"owl-numbers":""});paginationButton.append(paginationButtonInner);paginationButton.data("owl-page",lastPage===i?lastItem:i);paginationButton.data("owl-roundPages",counter);base.paginationWrapper.append(paginationButton);}}base.checkPagination();},checkPagination:function(){var base=this;if(base.options.pagination===false){return false;}base.paginationWrapper.find(".owl-page").each(function(){if($(this).data("owl-roundPages")===$(base.$owlItems[base.currentItem]).data("owl-roundPages")){base.paginationWrapper.find(".owl-page").removeClass("active");$(this).addClass("active");}});},checkNavigation:function(){var base=this;if(base.options.navigation===false){return false;}if(base.options.rewindNav===false){if(base.currentItem===0&&base.maximumItem===0){base.buttonPrev.addClass("disabled");base.buttonNext.addClass("disabled");}else if(base.currentItem===0&&base.maximumItem!==0){base.buttonPrev.addClass("disabled");base.buttonNext.removeClass("disabled");}else if(base.currentItem===base.maximumItem){base.buttonPrev.removeClass("disabled");base.buttonNext.addClass("disabled");}else if(base.currentItem!==0&&base.currentItem!==base.maximumItem){base.buttonPrev.removeClass("disabled");base.buttonNext.removeClass("disabled");}}},updateControls:function(){var base=this;base.updatePagination();base.checkNavigation();if(base.owlControls){if(base.options.items>=base.itemsAmount){base.owlControls.hide();}else{base.owlControls.show();}}},destroyControls:function(){var base=this;if(base.owlControls){base.owlControls.remove();}},next:function(speed){var base=this;if(base.isTransition){return false;}base.currentItem+=base.options.scrollPerPage===true?base.options.items:1;if(base.currentItem>base.maximumItem+(base.options.scrollPerPage===true?(base.options.items-1):0)){if(base.options.rewindNav===true){base.currentItem=0;speed="rewind";}else{base.currentItem=base.maximumItem;return false;}}base.goTo(base.currentItem,speed);},prev:function(speed){var base=this;if(base.isTransition){return false;}if(base.options.scrollPerPage===true&&base.currentItem>0&&base.currentItem=base.maximumItem){position=base.maximumItem;}else if(position<=0){position=0;}base.currentItem=base.owl.currentItem=position;if(base.options.transitionStyle!==false&&drag!=="drag"&&base.options.items===1&&base.browser.support3d===true){base.swapSpeed(0);if(base.browser.support3d===true){base.transition3d(base.positionsInArray[position]);}else{base.css2slide(base.positionsInArray[position],1);}base.afterGo();base.singleItemTransition();return false;}goToPixel=base.positionsInArray[position];if(base.browser.support3d===true){base.isCss3Finish=false;if(speed===true){base.swapSpeed("paginationSpeed");window.setTimeout(function(){base.isCss3Finish=true;},base.options.paginationSpeed);}else if(speed==="rewind"){base.swapSpeed(base.options.rewindSpeed);window.setTimeout(function(){base.isCss3Finish=true;},base.options.rewindSpeed);}else{base.swapSpeed("slideSpeed");window.setTimeout(function(){base.isCss3Finish=true;},base.options.slideSpeed);}base.transition3d(goToPixel);}else{if(speed===true){base.css2slide(goToPixel,base.options.paginationSpeed);}else if(speed==="rewind"){base.css2slide(goToPixel,base.options.rewindSpeed);}else{base.css2slide(goToPixel,base.options.slideSpeed);}}base.afterGo();},jumpTo:function(position){var base=this;if(typeof base.options.beforeMove==="function"){base.options.beforeMove.apply(this,[base.$elem]);}if(position>=base.maximumItem||position===-1){position=base.maximumItem;}else if(position<=0){position=0;}base.swapSpeed(0);if(base.browser.support3d===true){base.transition3d(base.positionsInArray[position]);}else{base.css2slide(base.positionsInArray[position],1);}base.currentItem=base.owl.currentItem=position;base.afterGo();},afterGo:function(){var base=this;base.prevArr.push(base.currentItem);base.prevItem=base.owl.prevItem=base.prevArr[base.prevArr.length-2];base.prevArr.shift(0);if(base.prevItem!==base.currentItem){base.checkPagination();base.checkNavigation();base.eachMoveUpdate();if(base.options.autoPlay!==false){base.checkAp();}}if(typeof base.options.afterMove==="function"&&base.prevItem!==base.currentItem){base.options.afterMove.apply(this,[base.$elem]);}},stop:function(){var base=this;base.apStatus="stop";window.clearInterval(base.autoPlayInterval);},checkAp:function(){var base=this;if(base.apStatus!=="stop"){base.play();}},play:function(){var base=this;base.apStatus="play";if(base.options.autoPlay===false){return false;}window.clearInterval(base.autoPlayInterval);base.autoPlayInterval=window.setInterval(function(){base.next(true);},base.options.autoPlay);},swapSpeed:function(action){var base=this;if(action==="slideSpeed"){base.$owlWrapper.css(base.addCssSpeed(base.options.slideSpeed));}else if(action==="paginationSpeed"){base.$owlWrapper.css(base.addCssSpeed(base.options.paginationSpeed));}else if(typeof action!=="string"){base.$owlWrapper.css(base.addCssSpeed(action));}},addCssSpeed:function(speed){return{"-webkit-transition":"all "+speed+"ms ease","-moz-transition":"all "+speed+"ms ease","-o-transition":"all "+speed+"ms ease","transition":"all "+speed+"ms ease"};},removeTransition:function(){return{"-webkit-transition":"","-moz-transition":"","-o-transition":"","transition":""};},doTranslate:function(pixels){return{"-webkit-transform":"translate3d("+pixels+"px, 0px, 0px)","-moz-transform":"translate3d("+pixels+"px, 0px, 0px)","-o-transform":"translate3d("+pixels+"px, 0px, 0px)","-ms-transform":"translate3d("+pixels+"px, 0px, 0px)","transform":"translate3d("+pixels+"px, 0px,0px)"};},transition3d:function(value){var base=this;base.$owlWrapper.css(base.doTranslate(value));},css2move:function(value){var base=this;base.$owlWrapper.css({"left":value});},css2slide:function(value,speed){var base=this;base.isCssFinish=false;base.$owlWrapper.stop(true,true).animate({"left":value},{duration:speed||base.options.slideSpeed,complete:function(){base.isCssFinish=true;}});},checkBrowser:function(){var base=this,translate3D="translate3d(0px, 0px, 0px)",tempElem=document.createElement("div"),regex,asSupport,support3d,isTouch;tempElem.style.cssText=" -moz-transform:"+translate3D+"; -ms-transform:"+translate3D+"; -o-transform:"+translate3D+"; -webkit-transform:"+translate3D+"; transform:"+translate3D;regex=/translate3d\(0px, 0px, 0px\)/g;asSupport=tempElem.style.cssText.match(regex);support3d=(asSupport!==null&&asSupport.length===1);isTouch="ontouchstart"in window||window.navigator.msMaxTouchPoints;base.browser={"support3d":support3d,"isTouch":isTouch};},moveEvents:function(){var base=this;if(base.options.mouseDrag!==false||base.options.touchDrag!==false){base.gestures();base.disabledEvents();}},eventTypes:function(){var base=this,types=["s","e","x"];base.ev_types={};if(base.options.mouseDrag===true&&base.options.touchDrag===true){types=["touchstart.owl mousedown.owl","touchmove.owl mousemove.owl","touchend.owl touchcancel.owl mouseup.owl"];}else if(base.options.mouseDrag===false&&base.options.touchDrag===true){types=["touchstart.owl","touchmove.owl","touchend.owl touchcancel.owl"];}else if(base.options.mouseDrag===true&&base.options.touchDrag===false){types=["mousedown.owl","mousemove.owl","mouseup.owl"];}base.ev_types.start=types[0];base.ev_types.move=types[1];base.ev_types.end=types[2];},disabledEvents:function(){var base=this;base.$elem.on("dragstart.owl",function(event){event.preventDefault();});base.$elem.on("mousedown.disableTextSelect",function(e){return $(e.target).is('input, textarea, select, option');});},gestures:function(){var base=this,locals={offsetX:0,offsetY:0,baseElWidth:0,relativePos:0,position:null,minSwipe:null,maxSwipe:null,sliding:null,dargging:null,targetElement:null};base.isCssFinish=true;function getTouches(event){if(event.touches!==undefined){return{x:event.touches[0].pageX,y:event.touches[0].pageY};}if(event.touches===undefined){if(event.pageX!==undefined){return{x:event.pageX,y:event.pageY};}if(event.pageX===undefined){return{x:event.clientX,y:event.clientY};}}}function swapEvents(type){if(type==="on"){$(document).on(base.ev_types.move,dragMove);$(document).on(base.ev_types.end,dragEnd);}else if(type==="off"){$(document).off(base.ev_types.move);$(document).off(base.ev_types.end);}}function dragStart(event){var ev=event.originalEvent||event||window.event,position;if(ev.which===3){return false;}if(base.itemsAmount<=base.options.items){return;}if(base.isCssFinish===false&&!base.options.dragBeforeAnimFinish){return false;}if(base.isCss3Finish===false&&!base.options.dragBeforeAnimFinish){return false;}if(base.options.autoPlay!==false){window.clearInterval(base.autoPlayInterval);}if(base.browser.isTouch!==true&&!base.$owlWrapper.hasClass("grabbing")){base.$owlWrapper.addClass("grabbing");}base.newPosX=0;base.newRelativeX=0;$(this).css(base.removeTransition());position=$(this).position();locals.relativePos=position.left;locals.offsetX=getTouches(ev).x-position.left;locals.offsetY=getTouches(ev).y-position.top;swapEvents("on");locals.sliding=false;locals.targetElement=ev.target||ev.srcElement;}function dragMove(event){var ev=event.originalEvent||event||window.event,minSwipe,maxSwipe;base.newPosX=getTouches(ev).x-locals.offsetX;base.newPosY=getTouches(ev).y-locals.offsetY;base.newRelativeX=base.newPosX-locals.relativePos;if(typeof base.options.startDragging==="function"&&locals.dragging!==true&&base.newRelativeX!==0){locals.dragging=true;base.options.startDragging.apply(base,[base.$elem]);}if((base.newRelativeX>8||base.newRelativeX<-8)&&(base.browser.isTouch===true)){if(ev.preventDefault!==undefined){ev.preventDefault();}else{ev.returnValue=false;}locals.sliding=true;}if((base.newPosY>10||base.newPosY<-10)&&locals.sliding===false){$(document).off("touchmove.owl");}minSwipe=function(){return base.newRelativeX/5;};maxSwipe=function(){return base.maximumPixels+base.newRelativeX/5;};base.newPosX=Math.max(Math.min(base.newPosX,minSwipe()),maxSwipe());if(base.browser.support3d===true){base.transition3d(base.newPosX);}else{base.css2move(base.newPosX);}}function dragEnd(event){var ev=event.originalEvent||event||window.event,newPosition,handlers,owlStopEvent;ev.target=ev.target||ev.srcElement;locals.dragging=false;if(base.browser.isTouch!==true){base.$owlWrapper.removeClass("grabbing");}if(base.newRelativeX<0){base.dragDirection=base.owl.dragDirection="left";}else{base.dragDirection=base.owl.dragDirection="right";}if(base.newRelativeX!==0){newPosition=base.getNewPosition();base.goTo(newPosition,false,"drag");if(locals.targetElement===ev.target&&base.browser.isTouch!==true){$(ev.target).on("click.disable",function(ev){ev.stopImmediatePropagation();ev.stopPropagation();ev.preventDefault();$(ev.target).off("click.disable");});handlers=$._data(ev.target,"events").click;owlStopEvent=handlers.pop();handlers.splice(0,0,owlStopEvent);}}swapEvents("off");}base.$elem.on(base.ev_types.start,".owl-wrapper",dragStart);},getNewPosition:function(){var base=this,newPosition=base.closestItem();if(newPosition>base.maximumItem){base.currentItem=base.maximumItem;newPosition=base.maximumItem;}else if(base.newPosX>=0){newPosition=0;base.currentItem=0;}return newPosition;},closestItem:function(){var base=this,array=base.options.scrollPerPage===true?base.pagesInArray:base.positionsInArray,goal=base.newPosX,closest=null;$.each(array,function(i,v){if(goal-(base.itemWidth/20)>array[i+1]&&goal-(base.itemWidth/20)(array[i+1]||array[i]-base.itemWidth)&&base.moveDirection()==="right"){if(base.options.scrollPerPage===true){closest=array[i+1]||array[array.length-1];base.currentItem=$.inArray(closest,base.positionsInArray);}else{closest=array[i+1];base.currentItem=i+1;}}});return base.currentItem;},moveDirection:function(){var base=this,direction;if(base.newRelativeX<0){direction="right";base.playDirection="next";}else{direction="left";base.playDirection="prev";}return direction;},customEvents:function(){var base=this;base.$elem.on("owl.next",function(){base.next();});base.$elem.on("owl.prev",function(){base.prev();});base.$elem.on("owl.play",function(event,speed){base.options.autoPlay=speed;base.play();base.hoverStatus="play";});base.$elem.on("owl.stop",function(){base.stop();base.hoverStatus="stop";});base.$elem.on("owl.goTo",function(event,item){base.goTo(item);});base.$elem.on("owl.jumpTo",function(event,item){base.jumpTo(item);});},stopOnHover:function(){var base=this;if(base.options.stopOnHover===true&&base.browser.isTouch!==true&&base.options.autoPlay!==false){base.$elem.on("mouseover",function(){base.stop();});base.$elem.on("mouseout",function(){if(base.hoverStatus!=="stop"){base.play();}});}},lazyLoad:function(){var base=this,i,$item,itemNumber,$lazyImg,follow;if(base.options.lazyLoad===false){return false;}for(i=0;i=base.currentItem;}else{follow=true;}if(follow&&itemNumber=base.$userItems.length||position===-1){base.$userItems.eq(-1).after(htmlString);}else{base.$userItems.eq(position).before(htmlString);}base.setVars();},removeItem:function(targetPosition){var base=this,position;if(base.$elem.children().length===0){return false;}if(targetPosition===undefined||targetPosition===-1){position=-1;}else{position=targetPosition;}base.unWrap();base.$userItems.eq(position).remove();base.setVars();}};$.fn.owlCarousel=function(options){return this.each(function(){if($(this).data("owl-init")===true){return false;}$(this).data("owl-init",true);var carousel=Object.create(Carousel);carousel.init(options,this);$.data(this,"owlCarousel",carousel);});};$.fn.owlCarousel.options={items:5,itemsCustom:false,itemsDesktop:[1199,1],itemsDesktopSmall:[979,1],itemsTablet:[768,1],itemsTabletSmall:false,itemsMobile:[479,1],singleItem:false,itemsScaleUp:false,slideSpeed:200,paginationSpeed:800,rewindSpeed:1000,autoPlay:false,stopOnHover:false,navigation:false,navigationText:["prev","next"],rewindNav:true,scrollPerPage:false,pagination:true,paginationNumbers:false,responsive:true,responsiveRefreshRate:200,responsiveBaseWidth:window,baseClass:"owl-carousel",theme:"owl-theme",lazyLoad:false,lazyFollow:true,lazyEffect:"fade",autoHeight:false,jsonPath:false,jsonSuccess:false,dragBeforeAnimFinish:true,mouseDrag:true,touchDrag:true,addClassActive:false,transitionStyle:false,beforeUpdate:false,afterUpdate:false,beforeInit:false,afterInit:false,beforeMove:false,afterMove:false,afterAction:false,startDragging:false,afterLazyLoad:false};}(jQuery,window,document)); $(function(){ $('#owl-demo').owlCarousel({ items: 1, navigation: true, navigationText: ["上一个","下一个"], autoPlay: true, stopOnHover: true }).hover(function(){ $('.owl-buttons').show(); }, function(){ $('.owl-buttons').hide(); }); }); function OnQVerify(btnobj, codeobj) { QVerify({ name: "人机验证", // 验证面板标题 desc: "滑动滑块,使图片显示角度为正", // 验证操作提示文字 cloneTxt: "点我关闭", // 关闭验证面板文字 successTxt: "验证成功,{0}秒后自动关闭", // {0}必须有,延迟关闭时间显示 errorTxt: "验证失败,请重试", images: ["../images/t1.jpg", "../images/t2.jpg", "../images/t3.jpg", "../images/t4.jpg", "../images/t5.jpg"], // 图片数组 将会随机从里面选取一张 duration: 2, //定时关闭时间 默认 2 mountDiv: "#QVerify", // 装载div 默认 #QVerify slideDifference: 5, // 滑动误差值 默认 5 defaultDifference: 50, // 默认图片角度最小差值 默认 50 mousedown: function (e) { // 按下鼠标事件 // e: 元素本身 console.log('按下了鼠标'); }, mousemove: function (e, moveWidth) { // 移动鼠标事件 // e: 元素本身 // moveWidth: 移动距离 console.log("移动了鼠标"); console.log(moveWidth); }, mouseup: function (e, moveWidth) { // 抬起鼠标事件 // e: 元素本身 // moveWidth: 移动距离 console.log("抬起了鼠标"); console.log(moveWidth); }, success: function () { // 验证成功事件 $(codeobj).val('1'); console.log("验证成功"); }, fail: function () { // 验证失败事件 console.log("验证失败"); }, complete: function () { // 验证完成事件 成功失败都会执行(执行顺序: complete->success 或 complete->fail) console.log("触发验证"); }, clone: function (status) { // 关闭验证面板事件 // status 返回的状态 // false: 失败状态下关闭; true: 成功状态下关闭; console.log(status); $(btnobj).click();//已验证提交数据 } }); }; function QVerify() { var option = { name: arguments[0].name || "人机验证", desc: arguments[0].desc || "滑动滑块,使图片显示角度为正", cloneTxt: arguments[0].cloneTxt || "关闭", successTxt: arguments[0].successTxt || "验证成功,{0}秒后自动关闭", errorTxt: arguments[0].errorTxt || "验证失败,请重试", images: arguments[0].images || [], duration: arguments[0].duration || 2, mountDiv: arguments[0].mountDiv || "#QVerify", slideDifference: arguments[0].slideDifference || 5, defaultDifference: arguments[0].defaultDifference || 50, mousedown: arguments[0].mousedown || function (e) { }, mousemove: arguments[0].mousemove || function (e, moveWidth) { }, mouseup: arguments[0].mouseup || function (e, moveWidth) { }, success: arguments[0].success || function () { }, fail: arguments[0].fail || function () { }, complete: arguments[0].complete || function () { }, clone: arguments[0].clone || function (status) { }, }; var image = option.images[Math.floor(Math.random() * option.images.length + 1) - 1], QVerifyHTML = ''; getEl(option.mountDiv).style.visibility = 'visible'; getEl(option.mountDiv).innerHTML = QVerifyHTML; getEl(".QVerify").style.visibility = 'visible'; var downX, imgDeg = randomNum(), lineDiv = getEl("#QVerify-silder"), minDiv = getEl("#QVerify-silder-btn"), imgDiv = getEl("#QVerify-verifyImg"), cloneDiv = getEl(".QVerify-clone"), totalWidth = (lineDiv.clientWidth - minDiv.clientWidth - 8), stride = 360 / totalWidth, hasTouch = window.matchMedia('(pointer: coarse)').matches; imgDiv.style.transform = "rotate(" + imgDeg + "deg)"; if (hasTouch) { minDiv.ontouchstart = onmousedownHandler; } else { minDiv.onmousedown = onmousedownHandler; } function onmousedownHandler(e) { downX = e.clientX || e.changedTouches[0].clientX; document.onmousemove = document.ontouchmove = mousemoveHandler; document.onmouseup = document.ontouchend = mouseupHandler; option.mousedown(e); e.stopPropagation(); }; function mousemoveHandler(event) { var e = event || window.event || e.which; e.preventDefault(); var moveX = 0; try { moveX = ((e.clientX) - downX) || ((e.changedTouches[0].clientX) - downX); } catch (e) { moveX = 0; } if (moveX >= totalWidth) { moveX = totalWidth; } if (moveX <= 0) { moveX = 0; } minDiv.style.left = moveX + 'px'; imgDiv.style.transform = "rotate(" + (imgDeg + (moveX * stride) - 360) + "deg)"; option.mousemove(e, moveX); e.preventDefault(); }; //cloneDiv.onclick = clone; function mouseupHandler(event) { document.onmousemove = null; document.onmouseup = null; var moveX = 0; try { moveX = ((event.clientX) - downX) || ((event.changedTouches[0].clientX) - downX); } catch (e) { moveX = 0; } moveX <= 0 ? 0 : moveX; var deg = /(\d+(\.\d+)?)/g.exec(imgDiv.style.transform)[0]; if ((0 <= deg && deg <= (0 + option.slideDifference))) { //cloneDiv.onclick = null; getEl(".QVerify-success").style.display = 'block'; getEl(".QVerify-result").innerText = option.successTxt.signMix(option.duration); getEl(".QVerify-result").style.color = '#00a344'; option.complete(); option.success(); setTimeout(function () { clone('s'); }, option.duration * 1000); } else { getEl(".QVerify-success").style.display = 'none'; getEl(".QVerify-result").innerText = option.errorTxt; getEl(".QVerify-result").style.color = '#ff0016'; imgDiv.style.transform = "rotate(" + imgDeg + "deg)"; minDiv.style.left = '0px'; option.complete(); option.fail(); } option.mouseup(event, moveX); }; function clone(status) { getEl(".QVerify-success").style.display = 'none'; getEl(".QVerify-result").innerText = null; imgDiv.style.transform = "rotate(" + imgDeg + "deg)"; minDiv.style.left = '0px'; getEl(".QVerify").style.visibility = 'hidden'; getEl(option.mountDiv).style.visibility = 'hidden'; if (status !== 's') { option.clone(false); } else { option.clone(true); } }; String.prototype.signMix = function () { if (arguments.length === 0) return this; var param = arguments[0], str = this; if (typeof (param) === 'object') { for (var key in param) str = str.replace(new RegExp("\\{" + key + "\\}", "g"), param[key]); return str; } else { for (var i = 0; i < arguments.length; i++) str = str.replace(new RegExp("\\{" + i + "\\}", "g"), arguments[i]); return str; } }; function randomNum() { var num = Math.ceil(Math.random() * 360); if ((num <= (0 + option.slideDifference + option.defaultDifference)) || ((360 - option.slideDifference - option.defaultDifference) <= num)) { return randomNum(); } return num; }; function getEl(el) { var type = el.substr(0, 1); var obj = el.substr(1); if (type === '.') { return document.getElementsByClassName(obj)[0]; } else if (type === '#') { return document.getElementById(obj); } else { return false; } }; }; //** Smooth Navigational Menu- By Dynamic Drive DHTML code library: http://www.dynamicdrive.com //** Script Download/ instructions page: http://www.dynamicdrive.com/dynamicindex1/ddlevelsmenu/ //** Menu created: Nov 12, 2008 //** Dec 12th, 08" (v1.01): Fixed Shadow issue when multiple LIs within the same UL (level) contain sub menus: http://www.dynamicdrive.com/forums/showthread.php?t=39177&highlight=smooth //** Feb 11th, 09" (v1.02): The currently active main menu item (LI A) now gets a CSS class of ".selected", including sub menu items. //** May 1st, 09" (v1.3): //** 1) Now supports vertical (side bar) menu mode- set "orientation" to 'v' //** 2) In IE6, shadows are now always disabled //** July 27th, 09" (v1.31): Fixed bug so shadows can be disabled if desired. //** Feb 2nd, 10" (v1.4): Adds ability to specify delay before sub menus appear and disappear, respectively. See showhidedelay variable below //** Dec 17th, 10" (v1.5): Updated menu shadow to use CSS3 box shadows when the browser is FF3.5+, IE9+, Opera9.5+, or Safari3+/Chrome. Only .js file changed. var ddsmoothmenu={ //Specify full URL to down and right arrow images (23 is padding-right added to top level LIs with drop downs): transition: {overtime:300, outtime:300}, //duration of slide in/ out animation, in milliseconds shadow: {enable:true, offsetx:5, offsety:5}, //enable shadow? showhidedelay: {showdelay: 100, hidedelay: 200}, //set delay in milliseconds before sub menus appear and disappear, respectively ///////Stop configuring beyond here/////////////////////////// detectwebkit: navigator.userAgent.toLowerCase().indexOf("applewebkit")!=-1, //detect WebKit browsers (Safari, Chrome etc) detectie6: document.all && !window.XMLHttpRequest, css3support: window.msPerformance || (!document.all && document.querySelector), //detect browsers that support CSS3 box shadows (ie9+ or FF3.5+, Safari3+, Chrome etc) getajaxmenu:function($, setting){ //function to fetch external page containing the panel DIVs var $menucontainer=$('#'+setting.contentsource[0]) //reference empty div on page that will hold menu $menucontainer.html("Loading Menu...") $.ajax({ url: setting.contentsource[1], //path to external menu file async: true, error:function(ajaxrequest){ $menucontainer.html('Error fetching content. Server Response: '+ajaxrequest.responseText) }, success:function(content){ $menucontainer.html(content) ddsmoothmenu.buildmenu($, setting) } }) }, buildmenu:function($, setting){ var smoothmenu=ddsmoothmenu var $mainmenu=$("#"+setting.mainmenuid+">ul") //reference main menu UL $mainmenu.parent().get(0).className=setting.classname || "ddsmoothmenu" var $headers=$mainmenu.find("ul").parent() $headers.hover( function(e){ $(this).children('a:eq(0)').addClass('selected') }, function(e){ $(this).children('a:eq(0)').removeClass('selected') } ) $headers.each(function(i){ //loop through each LI header var $curobj=$(this).css({}) //reference current LI header var $subul=$(this).find('ul:eq(0)').css({display:'block'}) $subul.data('timers', {}) this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()} this.istopheader=$curobj.parents("ul").length==1? true : false //is top level header? $subul.css({top:this.istopheader && setting.orientation!='v'? this._dimensions.h+"px" : 0}) if (smoothmenu.shadow.enable && !smoothmenu.css3support){ //if shadows enabled and browser doesn't support CSS3 box shadows this._shadowoffset={x:(this.istopheader?$subul.offset().left+smoothmenu.shadow.offsetx : this._dimensions.w), y:(this.istopheader? $subul.offset().top+smoothmenu.shadow.offsety : $curobj.position().top)} //store this shadow's offsets if (this.istopheader) $parentshadow=$(document.body) else{ var $parentLi=$curobj.parents("li:eq(0)") $parentshadow=$parentLi.get(0).$shadow } this.$shadow=$('
    ').prependTo($parentshadow).css({left:this._shadowoffset.x+'px', top:this._shadowoffset.y+'px'}) //insert shadow DIV and set it to parent node for the next shadow div } $curobj.hover( function(e){ var $targetul=$subul //reference UL to reveal var header=$curobj.get(0) //reference header LI as DOM object clearTimeout($targetul.data('timers').hidetimer) $targetul.data('timers').showtimer=setTimeout(function(){ header._offsets={left:$curobj.offset().left, top:$curobj.offset().top} var menuleft=header.istopheader && setting.orientation!='v'? 0 : header._dimensions.w menuleft=(header._offsets.left+menuleft+header._dimensions.subulw>$(window).width())? (header.istopheader && setting.orientation!='v'? -header._dimensions.subulw+header._dimensions.w : -header._dimensions.w) : menuleft //calculate this sub menu's offsets from its parent if ($targetul.queue().length<=1){ //if 1 or less queued animations $targetul.css({left:menuleft+"px", width:header._dimensions.subulw+'px'}).animate({height:'show',opacity:'show'}, ddsmoothmenu.transition.overtime) if (smoothmenu.shadow.enable && !smoothmenu.css3support){ var shadowleft=header.istopheader? $targetul.offset().left+ddsmoothmenu.shadow.offsetx : menuleft var shadowtop=header.istopheader?$targetul.offset().top+smoothmenu.shadow.offsety : header._shadowoffset.y if (!header.istopheader && ddsmoothmenu.detectwebkit){ //in WebKit browsers, restore shadow's opacity to full header.$shadow.css({opacity:1}) } header.$shadow.css({overflow:'', width:header._dimensions.subulw+'px', left:shadowleft+'px', top:shadowtop+'px'}).animate({height:header._dimensions.subulh+'px'}, ddsmoothmenu.transition.overtime) } } }, ddsmoothmenu.showhidedelay.showdelay) }, function(e){ var $targetul=$subul var header=$curobj.get(0) clearTimeout($targetul.data('timers').showtimer) $targetul.data('timers').hidetimer=setTimeout(function(){ $targetul.animate({height:'hide', opacity:'hide'}, ddsmoothmenu.transition.outtime) if (smoothmenu.shadow.enable && !smoothmenu.css3support){ if (ddsmoothmenu.detectwebkit){ //in WebKit browsers, set first child shadow's opacity to 0, as "overflow:hidden" doesn't work in them header.$shadow.children('div:eq(0)').css({opacity:0}) } header.$shadow.css({overflow:'hidden'}).animate({height:0}, ddsmoothmenu.transition.outtime) } }, ddsmoothmenu.showhidedelay.hidedelay) } ) //end hover }) //end $headers.each() if (smoothmenu.shadow.enable && smoothmenu.css3support){ //if shadows enabled and browser supports CSS3 shadows var $toplevelul=$('#'+setting.mainmenuid+' ul li ul') //construct CSS3 box-shadow value var shadowprop=["boxShadow", "MozBoxShadow", "WebkitBoxShadow", "MsBoxShadow"] //possible vendor specific CSS3 shadow properties for (var i=0; i\n' +mainselector+' ul li a {background:'+setting.customtheme[0]+';}\n' +mainmenuid+' ul li a:hover {background:'+setting.customtheme[1]+';}\n' +'') } this.shadow.enable=(document.all && !window.XMLHttpRequest)? false : this.shadow.enable //in IE6, always disable shadow jQuery(document).ready(function($){ //ajax menu? if (typeof setting.contentsource=="object"){ //if external ajax menu ddsmoothmenu.getajaxmenu($, setting) } else{ //else if markup menu ddsmoothmenu.buildmenu($, setting) } }) } } //end ddsmoothmenu variable ddsmoothmenu.init({ mainmenuid: "smoothmenu1", //menu DIV id orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v" classname: 'ddsmoothmenu', //class added to menu's outer DIV //customtheme: ["#1c5a80", "#18374a"], contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"] })