$(function(){
//Masonry
var $container = $('#blog_contents');
$container.imagesLoaded( function(){
$container.masonry({
itemSelector: '.contents_block',
isResizable: true,
isAnimated: true
});
});
//Page Top
var pagetop = $('#page-top');
pagetop.hide();
$(window).scroll(function() {
if ($(this).scrollTop() > 100) {
pagetop.fadeIn();
} else {
pagetop.fadeOut();
}
});
$("#thumb1").on("load",function(){
var iw, ih;
var cw = 70; /*玄伉立件弘詨及產汔*/
var ch = 60; /*玄伉立件弘詨及衝汔*/
if((cw / $(this).width() * $(this).height()) <= ch){
$(this).css("height", ch);
$(this).css("width", "auto");
iw = ((ch / $(this).height() * $(this).width()) - cw) / 2;
$(this).css("left", "-"+iw+"px");
$(this).css("bottom", "0px");
}else{
$(this).css("width", cw);
$(this).css("height", "auto");
ih = ($(this).height() - ch);
$(this).css("left", "0px");
$(this).css("bottom", "-"+ih+"px");
}
});
$("#thumb2").on("load",function(){
var iw, ih;
var cw = 70; /*玄伉立件弘詨及產汔*/
var ch = 60; /*玄伉立件弘詨及衝汔*/
if((cw / $(this).width() * $(this).height()) <= ch){
$(this).css("height", ch);
$(this).css("width", "auto");
iw = ((ch / $(this).height() * $(this).width()) - cw) / 2;
$(this).css("left", "-"+iw+"px");
$(this).css("bottom", "0px");
}else{
$(this).css("width", cw);
$(this).css("height", "auto");
ih = ($(this).height() - ch);
$(this).css("left", "0px");
$(this).css("bottom", "-"+ih+"px");
}
});
$("#thumb3").on("load",function(){
var iw, ih;
var cw = 70; /*玄伉立件弘詨及產汔*/
var ch = 60; /*玄伉立件弘詨及衝汔*/
if((cw / $(this).width() * $(this).height()) <= ch){
$(this).css("height", ch);
$(this).css("width", "auto");
iw = ((ch / $(this).height() * $(this).width()) - cw) / 2;
$(this).css("left", "-"+iw+"px");
$(this).css("bottom", "0px");
}else{
$(this).css("width", cw);
$(this).css("height", "auto");
ih = ($(this).height() - ch);
$(this).css("left", "0px");
$(this).css("bottom", "-"+ih+"px");
}
});
$("#thumb4").on("load",function(){
var iw, ih;
var cw = 70; /*玄伉立件弘詨及產汔*/
var ch = 60; /*玄伉立件弘詨及衝汔*/
if((cw / $(this).width() * $(this).height()) <= ch){
$(this).css("height", ch);
$(this).css("width", "auto");
iw = ((ch / $(this).height() * $(this).width()) - cw) / 2;
$(this).css("left", "-"+iw+"px");
$(this).css("bottom", "0px");
}else{
$(this).css("width", cw);
$(this).css("height", "auto");
ih = ($(this).height() - ch);
$(this).css("left", "0px");
$(this).css("bottom", "-"+ih+"px");
}
});
$("#thumb5").on("load",function(){
var iw, ih;
var cw = 70; /*玄伉立件弘詨及產汔*/
var ch = 60; /*玄伉立件弘詨及衝汔*/
if((cw / $(this).width() * $(this).height()) <= ch){
$(this).css("height", ch);
$(this).css("width", "auto");
iw = ((ch / $(this).height() * $(this).width()) - cw) / 2;
$(this).css("left", "-"+iw+"px");
$(this).css("bottom", "0px");
}else{
$(this).css("width", cw);
$(this).css("height", "auto");
ih = ($(this).height() - ch);
$(this).css("left", "0px");
$(this).css("bottom", "-"+ih+"px");
}
});
$("#thumb6").on("load",function(){
var iw, ih;
var cw = 70; /*玄伉立件弘詨及產汔*/
var ch = 60; /*玄伉立件弘詨及衝汔*/
if((cw / $(this).width() * $(this).height()) <= ch){
$(this).css("height", ch);
$(this).css("width", "auto");
iw = ((ch / $(this).height() * $(this).width()) - cw) / 2;
$(this).css("left", "-"+iw+"px");
$(this).css("bottom", "0px");
}else{
$(this).css("width", cw);
$(this).css("height", "auto");
ih = ($(this).height() - ch);
$(this).css("left", "0px");
$(this).css("bottom", "-"+ih+"px");
}
});
$("#thumb7").on("load",function(){
var iw, ih;
var cw = 70; /*玄伉立件弘詨及產汔*/
var ch = 60; /*玄伉立件弘詨及衝汔*/
if((cw / $(this).width() * $(this).height()) <= ch){
$(this).css("height", ch);
$(this).css("width", "auto");
iw = ((ch / $(this).height() * $(this).width()) - cw) / 2;
$(this).css("left", "-"+iw+"px");
$(this).css("bottom", "0px");
}else{
$(this).css("width", cw);
$(this).css("height", "auto");
ih = ($(this).height() - ch);
$(this).css("left", "0px");
$(this).css("bottom", "-"+ih+"px");
}
});
$("#thumb8").on("load",function(){
var iw, ih;
var cw = 70; /*玄伉立件弘詨及產汔*/
var ch = 60; /*玄伉立件弘詨及衝汔*/
if((cw / $(this).width() * $(this).height()) <= ch){
$(this).css("height", ch);
$(this).css("width", "auto");
iw = ((ch / $(this).height() * $(this).width()) - cw) / 2;
$(this).css("left", "-"+iw+"px");
$(this).css("bottom", "0px");
}else{
$(this).css("width", cw);
$(this).css("height", "auto");
ih = ($(this).height() - ch);
$(this).css("left", "0px");
$(this).css("bottom", "-"+ih+"px");
}
});
$("#thumb9").on("load",function(){
var iw, ih;
var cw = 70; /*玄伉立件弘詨及產汔*/
var ch = 60; /*玄伉立件弘詨及衝汔*/
if((cw / $(this).width() * $(this).height()) <= ch){
$(this).css("height", ch);
$(this).css("width", "auto");
iw = ((ch / $(this).height() * $(this).width()) - cw) / 2;
$(this).css("left", "-"+iw+"px");
$(this).css("bottom", "0px");
}else{
$(this).css("width", cw);
$(this).css("height", "auto");
ih = ($(this).height() - ch);
$(this).css("left", "0px");
$(this).css("bottom", "-"+ih+"px");
}
});
});
// ╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯
//﹛﹛﹛﹛jQuery Slider2
// ╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯
(function($){$.fn.slider=function(options){var $this=this;var settings={'width':this.width(),'height':this.height(),'wait':4000,'fade':750,'direction':'left','showControls':true,'showProgress':true,'hoverPause':true,'autoplay':true,'slidebefore':function(){},'slideafter':function(){},'rewind':function(){}};var _timer=false;var _last=false;var _this=false;var _cycle=function(){clearTimeout(_timer);_last=_this;if(settings.direction=='right'){_this=_this.prev('.jquery-slider-element');}else{_this=_this.next('.jquery-slider-element');}
if(!_this.length){_rewind();}
_draw();if(!$this.hasClass('jquery-slider-paused')&&settings.autoplay){_timer=setTimeout(_cycle,settings.wait);}};var _rewind=function(){if(settings.direction=='right'){_this=$this.children('.jquery-slider-element').last();}else{_this=$this.children('.jquery-slider-element').first();}
settings.rewind(_this,$this);};var _draw=function(){$this.addClass('jquery-slider-sliding');if(settings.showProgress){$this.find('.jquery-slider-page').removeClass('jquery-slider-page-current');$this.find('.jquery-slider-page:nth-child('+(_this.nextAll('.jquery-slider-element').length+1)+')').addClass('jquery-slider-page-current');}
settings.slidebefore(_this,$this);if(settings.direction=='right'){_this.show().css('left',-settings.width);}else{_this.show().css('left',settings.width);}
_this.stop(true,true).animate({'left':(settings.direction=='right'?'+=':'-=')+settings.width+'px'},{'duration':settings.fade,'complete':function(){settings.slideafter(_this,$this);$this.removeClass('jquery-slider-sliding');}});if(_last){_last.stop(true,true).animate({'left':(settings.direction=='right'?'+=':'-=')+settings.width+'px'},{'duration':settings.fade});}};var _next=function(){if($this.hasClass('jquery-slider-sliding'))return;var direction=settings.direction;$this.addClass('jquery-slider-paused');settings.direction='left';_cycle();settings.direction=direction;};var _prev=function(){if($this.hasClass('jquery-slider-sliding'))return;var direction=settings.direction;$this.addClass('jquery-slider-paused');settings.direction='right';_cycle();settings.direction=direction;};var _init=function(){if(options){$.extend(settings,options);}
if(settings.hoverPause){$this.bind({'mouseenter':function(){$this.addClass('jquery-slider-paused')
clearTimeout(_timer);},'mouseleave':function(){$this.removeClass('jquery-slider-paused');if(settings.autoplay){_timer=setTimeout(_cycle,settings.wait);}}});}
var positionEls=$('');$this.addClass('jquery-slider').width(settings.width).height(settings.height);$this.children().each(function(){_this=$(this).addClass('jquery-slider-element');positionEls.append('');});if(settings.showProgress){$this.append(positionEls);}
if(settings.showControls){var controlPrev=$('').bind('click',function(){_prev();});var controlNext=$('').bind('click',function(){_next();});$this.append(controlPrev);$this.append(controlNext);}
_cycle();};_init();};})(jQuery);
// ╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯
//﹛﹛﹛﹛jQuery 旦丞□朮旦弁伕□伙
// ╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯╯
(function($){
$.extend({
smoothAnchors : function(speed, easing, redirect){
speed = speed || "fast";
easing = easing || null;
redirect = (redirect === true || redirect == null) ? true : false;
$("a").each(function(i){
var url = $(this).attr("href");
if(url){
if(url.indexOf("#") != -1 && url.indexOf("#") == 0){
var aParts = url.split("#",2);
var anchor = $("a[name='"+aParts[1]+"']");
if(anchor){
$(this).click(function(){
if($(document).height()-anchor.offset().top >= $(window).height()
|| anchor.offset().top > $(window).height()
|| $(document).width()-anchor.offset().left >= $(window).width()
|| anchor.offset().left > $(window).width()){
$('html, body').animate({
scrollTop: anchor.offset().top,
scrollLeft: anchor.offset().left
}, speed, easing, function(){
if(redirect){
window.location = url
}
});
}
return false;
});
}
}
}
});
}
});
})(jQuery);
$(document).ready(function(){
$.smoothAnchors("fast");
});