您的位置:首页 > 其它

开发问题集

2014-12-10 19:46 190 查看
1.疑问拿到一个640*1136的设计图,开发中怎么高度还原?

   在chrome中f12手机模式,选中iphone5,是320*568的,而实际上iphone5的高大上Retina屏是640*1136的分辨率,Retina屏和普屏分辨率恰好是两倍。在开发中,我们按320*568开发即可,拿到设计稿,扔进ps里,把量到的长宽除以2就是啦。

更多阅读:

http://www.zhihu.com/question/20583941?group_id=114817350

http://www.cnblogs.com/BigPolarBear/archive/2012/03/26/2417777.html

2.透明背景,内容文字不透明

    background: rgba(255,255,255,.7); //正道!

     //background: #fff;

     //opacity: 0.7;

   rgba中的alpha和opacity区别是什么?没错,就是不会对子元素产生影响

更多阅读:

http://kayosite.com/css3-rgba-color.html

3.新生成的元素动态绑定

错误示范:

$(document).ready(function() {

  $(".add").click(function() {

    $(this).addClass('cancel');

    $(this).removeClass('add'); 

  });

  $(".cancel").click(function() {//后来才生成的.cancel,这样是木有反应的。。。

    $(this).removeClass('cancel');

    $(this).addClass('add');

  });

});

人间正道:

$(document).ready(function() {

  $(document).on("click", ".add", function() {

   // code here 

  });

  $(document).on("click", ".cancel", function() {

   // code here 

  });

});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息