2014年5月6日 星期二
jquery address 能for jquery1.9以上的版本
https://raw.githubusercontent.com/asual/jquery-address/master/src/jquery.address.js
2013年10月15日 星期二
2013年8月27日 星期二
2013年6月19日 星期三
解決fadeIn與fadeOut在mouseover與out的動作後會持續重複動畫
$(".navleng").mouseover(function() { //When trigger is clicked...
$(this).find(".head_subnav").fadeIn(300).slideDown('fast'); //Drop down the subnav on click
$(this).hover(function() {
}, function(){
$(this).find(".head_subnav").stop(true).fadeOut(300).slideUp('fast');
});
});
在hover的相反裡加入.stop(true)即可,然後剛滑入時的fadeIn不要加。
$(this).find(".head_subnav").fadeIn(300).slideDown('fast'); //Drop down the subnav on click
$(this).hover(function() {
}, function(){
$(this).find(".head_subnav").stop(true).fadeOut(300).slideUp('fast');
});
});
在hover的相反裡加入.stop(true)即可,然後剛滑入時的fadeIn不要加。
2013年1月14日 星期一
scrolltop chrome firefox某一項無作用
原本這樣用
$('body').stop().delay(800).stop().animate({
scrollTop:0
}, 800);
但常常firefox無作用
於是加入下面html就可
$('body,html').stop().delay(800).stop().animate({
scrollTop:0
}, 800);
2012年9月20日 星期四
2012年9月11日 星期二
javascript只取數字 用正規表示
var str=$(".area_product").css('left');//出來會是312px
var reg=/[^\d]+/img;
str=str.replace(reg,"");
alert(str);//出來會是312
2012年8月9日 星期四
jquery 同時進行不同的動畫又不被取消或干擾
//同時進行不同的動畫又不被取消
alpha_40();
$("#about_content").animate({scrollTop: $('#about_human_WOW').offset().top-use_top_dis},{queue: false,duration: 3000,complete:function(){$("#goTop").fadeIn();}});
function alpha_40(){
$("#about_content").animate({opacity: 0.2},{queue: false,duration: 500,complete:function(){alpha_mid()}});
}
function alpha_mid(){
$("#about_content").animate({opacity: 0.2},{queue: false,duration: 2500,complete:function(){alpha_100()}});
}
function alpha_100(){
$("#about_content").animate({opacity: 1},{queue: false,duration:2000});
}
參考
http://alphasis.info/2011/09/jquery-api-animate-properties-options-queue/
2012年8月2日 星期四
jquery Iframe控制父視窗內容
parent.$ <-----這樣使用
parent.$.colorbox.close();
parent.$.address.value('contactOK');
parent.$.colorbox.close();
parent.$.address.value('contactOK');
2012年7月17日 星期二
2012年5月30日 星期三
2012年5月15日 星期二
wordpress上使用jquery.masonry
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery-1.7.1.min.js"></script>
<?php wp_head(); ?>
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.masonry.min.js"></script>
注意
jquery主體要在最上面
中間要是wp_head()
下方才能載入jquery.masonry.min.js
$(function(){
$('#news_container').masonry({
// options
itemSelector : '.news_col',
columnWidth : 295
});
});
295是news_col這物件的寬+左右padding+左右margin
.news_col{
float:left;
background:#EFEFEF;
margin-bottom:15px;
margin-left:15px;
padding-left:10px;
padding-right:10px;
width:auto;
width:260px;
2011年12月28日 星期三
相當於FLASH的XY軸
$('#xxx').offset().top
$('#xxx').offset().left
$('# xxx ').offset({ top: 10, left: 30 });
$('#xxx').offset().left
$('# xxx ').offset({ top: 10, left: 30 });
jquery 視窗寬高度
alert($(window).height()); //瀏覽器當前窗口可視區域高度 alert($(document).height()); //瀏覽器當前窗口文檔的高度 alert($(document.body).height());//瀏覽器當前窗口文檔body的高度 alert($(document.body).outerHeight(true));//瀏覽器當前窗口文檔body的總高度 包括border padding margin alert($(window).width()); //瀏覽器當前窗口可視區域寬度 alert($(document).width());//瀏覽器當前窗口文檔對像寬度 alert($(document.body).width());//瀏覽器當前窗口文檔body的高度 alert($(document.body).outerWidth(true));//瀏覽器當前窗口文檔body的總寬度 包括border padding margin資料來源http://chaowei.wordpress.com/2011/04/15/jq-%E5%8F%96%E5%BE%97%E5%BC%8F%E7%AA%97%E9%AB%98/
2011年12月5日 星期一
偵測是否IPAD
//偵測是否IPAD
//返回boolean值 True 或者 False
function is_IPhoneOrIPad(){
return ( (navigator.platform.indexOf("iPhone") != -1) || (navigator.platform.indexOf("iPad") != -1) );
}
//返回boolean值 True 或者 False
function is_IPhoneOrIPad(){
return ( (navigator.platform.indexOf("iPhone") != -1) || (navigator.platform.indexOf("iPad") != -1) );
}
IE8無法吃JQUERY $無法定義或NULL
都會顯示$無法定義或NULL的話
請檢察
Check your script include tag,
Check your script include tag,
is it usingtype="application/javascript" src="/path/to/jquery"
change totype="text/javascript" src="/path/to/jquery"
change totype="text/javascript" src="/path/to/jquery"
2011年11月27日 星期日
JQUERY attr屬性一直記不起來
$('#greatphoto').attr({
alt: 'Beijing Brush Seller',
title: 'photo by Kelly Clark'
});
alt: 'Beijing Brush Seller',
title: 'photo by Kelly Clark'
});
2011年10月18日 星期二
抓取一個div裡的第3張img 以及 取得eq有幾個數量
$(".post-body p img:eq(2)").attr("width");
$(".post-body p img").length
$(".post-body p img").length
2011年10月13日 星期四
取消物件滑鼠行為(蓋在上面的物件取消滑鼠偵測)
CSS設定
pointer-events:none;
IE很SUCK不行用
就跟AS3的
mouseEnabled=false;
mouseChildren=false;
的效果依樣
pointer-events:none;
IE很SUCK不行用
就跟AS3的
mouseEnabled=false;
mouseChildren=false;
的效果依樣
訂閱:
文章 (Atom)