2013年6月27日 星期四

以往可以用加上 -webkit-text-size-adjust : none 解決,但新版 Chrome 已經將 -webkit-text-size-adjust 支援移除。所以必須改以 -webkit-transform : scale( ... ) 處理, scale 中的數字為要設定的字型大小除以 12px ,例如 9px 就是 9 / 12 = 0.75 。請注意 display : inline 無法 transform ,請視情況加上 display : inline-block ,且目前看來 transform 會破壞字的間距:

-webkit-transform : scale(0.75);


from http://blog.xuite.net/vexed/tech/59449347-Chrome+font-size+%E5%B0%8F%E6%96%BC+12px

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不要加。

2013年5月2日 星期四

mysql中如何篩選出非重複資料

請參考
http://xcy.17cha8.cn/read.php/441.htm



使用mysql时,有时需要查询出某个字段不重复的记录,虽然mysql提供有distinct这个关键字来过滤掉多余的重复记录只保留一条,但往往只用它来返回不重复记录的条数,而不是用它来返回不重记录的所有值。其原因是distinct只能返回它的目标字段,而无法返回其它字段
下面先来看看例子:
   table
   id name
   1 a
   2 b
   3 c
   4 c
   5 b
比如我想用一条语句查询得到name不重复的所有数据,那就必须使用distinct去掉多余的重复记录。
select distinct name from table
得到的结果是:
   name
   a
   b
   c
好像达到效果了,可是,我想要得到的是id值呢?改一下查询语句吧:
select distinct name, id from table
结果会是:
   id name
   1 a
   2 b
   3 c
   4 c
   5 b
试了半天,也不行,最后在mysql手册里找到一个用法,
用group_concat(distinct name)配合group by name实现了我所需要的功能 5.0才支持的.
突然灵机一闪,既然可以使用group_concat函数,那其它函数能行吗?
赶紧用count函数一试,成功, 现在将完整语句放出:
select *, count(distinct name) from table group by name
结果:
   id name count(distinct name)
   1 a 1
   2 b 1
   3 c 1
再顺便说一句,group by 必须放在 order by 和 limit之前,不然会报错。。。OK了

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);

2013年1月10日 星期四

wordpress取得目前POST文章的路徑名稱 或是文章 ID


<?php
$pagename = get_query_var('pagename');
if ( !$pagename && $id > 0 ) {
// If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object
$post = $wp_query->get_queried_object();
 $pagename = $post->post_name;//目前文章 名稱
}
 $postid = get_the_ID();//目前文章ID

?>

2012年10月12日 星期五

flash call js 居然一定要用localhost才能測試


//用flash IDE測試不出來 要用localhost的方式或是丟到網路上 反正就是要成為網路模式 不能本機測試
import flash.external.ExternalInterface;
stop();

ck_mc.addEventListener(MouseEvent.MOUSE_DOWN, overGameMc);
function overGameMc(e:MouseEvent){

//---確認是否能呼叫外部javascript--ok=>true,之後在執行mouseopen()方法;      
 trace('123');
ExternalInterface.call("cool");

}


        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script language="javascript" >

var flashvars = {};
var params = {};
var attributes = {};

params.allowscriptaccess = "always";
attributes.id = "as3_js";
swfobject.embedSWF("trace.swf", "alt", "450", "450", "10.0.0", false, flashvars, params, attributes);

function cool(){
alert("cool");
}


</script>


<div class="as3">
<div id="alt"></div>
</div>