$(function() { /*-------------------------------*/ /*---��𧢲�罸�詨�?--*/ /*-------------------------------*/ var rwd = navigator.useragent, winwidth = $(window).width(), anowidth = 0, nowstatus = 0; var $mask = $('
').hide(); $('#page').after($mask); if (rwd.match(/iphone|ipad|ipod|android|blackberry/i)) { $('#nav-toggle').on('touchstart', menu); $('.mask').on('touchstart', menu); } else { $('#nav-toggle').on('click', menu); $('.mask').on('click', menu); } $("#menu a").click(function(evt) { $(this).next().slidetoggle(400); $(evt.currenttarget).find('span').toggleclass('icon-plus').toggleclass('icon-minus'); }); bgimg(); $(window).resize(function() { $mask.hide(); $('#nav-toggle').removeclass('show'); $('#page').removeclass('show'); $('html,body').removeclass('show'); $('#hed').removeclass('show'); $('#menu').removeclass('show'); delay(function() { bgimg(); }, 300); }) function menu() { $mask.fadetoggle(300); $('#nav-toggle').toggleclass('show'); $('#page').toggleclass('show'); $('html,body').toggleclass('show'); $('#hed').toggleclass('show'); $('#menu').toggleclass('show'); return false; } function menumode(e) { if (e < 1264) { nowstatus = 0; console.log('mobile menu'); } else { nowstatus = 1; console.log('desktop menu'); } } /*-------------------------------*/ /*---editor ?��??����?����??��---*/ /*-------------------------------*/ if ($('.edit').size() != 0) { $('.edit img').removeattr('style'); $('img.big').unwrap('p'); } var delay = (function() { var timer = 0; return function(callback, ms) { cleartimeout(timer); timer = settimeout(callback, ms); }; })(); function bgimg() { winwidth = $(window).width(); menumode(winwidth); if ($('.bg').size() !== 0 && winwidth > 767) { console.log($('.bg').size()); console.log('winwidth = ' + winwidth + 'screen width:' + anowidth); $('.bg').each(function(index, el) { var bgpic = 'url("' + $(this).find('img').attr('data-src') + '")'; $(this).css({ 'background-image': bgpic }); console.log(index + '/' + bgpic); }); } else { $('.bg').removeattr('style'); console.log('winwidth = ' + winwidth + 'screen width:' + anowidth); } } }) //=================================== �����r�� ======================================== $(function(){ var len = 100; // �w�l100�ӧr�h"..."���n $(".news-txt").each(function(i){ if($(this).text().length>len){ $(this).attr("title",$(this).text()); var text=$(this).text().substring(0,len-1)+"..."; $(this).text(text); } }); }); //=================================== language button ======================================== var mylanguagebtn = new languagebtn(); function languagebtn(){ var list = $(".language"); var btn = $(".language .sel-tit"); var atag = $(".language a"); btn.bind("click",function(e){ e.preventdefault(); list.toggleclass('on'); }); }