jquery mobile加载中效果_jquery mobile loading effect

jquery mobile有三种方式来控制loading效果:
1.$.mobile.loading()
2.$.mobile.showPageLoadingMsg()
3.$.mobile.hidePageLoadingMsg()
其中showPageLoadingMsg和hidePageLoadingMsg方法在1.2以后使用loading方法代替了。
具体示例如下:

//cue the page loader
$.mobile.loading( ‘show’ );

//use theme swatch “b”, a custom message, and no spinner
$.mobile.loading( ‘show’, { theme: “b”, text: “foo”, textonly: true, textVisible:true });

http://jquerymobile.com/demos/1.2.0/docs/api/methods.html

css3 gradient 渐变透明设置

background-image: -webkit-gradient(linear, right top, left top, rgba(255,255,255,0),#E1D9CD);/ Saf4+, Chrome /
background-image: -webkit-linear-gradient(left,rgba(255,255,255,0),#E1D9CD);/ Chrome 10+, Saf5.1+ /
background-image: -moz-linear-gradient(left,rgba(255,255,255,0),#E1D9CD);/ FF3.6 /
background-image: -ms-linear-gradient(left,rgba(255,255,255,0),#E1D9CD);/ IE10 /
background-image: -o-linear-gradient(left,rgba(255,255,255,0),#E1D9CD);/ Opera 11.10+ /
background-image: linear-gradient(left,rgba(255,255,255,0),#E1D9CD);}
这里用rgba颜色来设置颜色透明度,linear-gradient(left,rgba(255,255,255,0) 10%,#E1D9CD 10%);在颜色后面带上百分比来设置改颜色算占的比例

CSS响应式设计iPad专有CSS3_CSS Responsive design iPad-Specific CSS3

摘自:http://css-tricks.com/snippets/css/ipad-specific-css/在做响应式设计的时候个人兼容性css代码则将下面ipad兼容代码加入:

@media only screen and (device-width: 768px) {
/ For general iPad layouts /
}

@media only screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:portrait) {
/ For portrait layouts only /
}

@media only screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape) {
/ For landscape layouts only /
}

在为各种手持设备专有的css则如下:

@media handheld, only screen and (max-width: 980px),only screen and (device-width: 768px){}



@media only screen and (device-width: 768px) {
/ For general iPad layouts /
}

@media only screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:portrait) {
/ For portrait layouts only /
}

@media only screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape) {
/ For landscape layouts only /
}
http://css-tricks.com/snippets/css/ipad-specific-css/


css3 background-size图片显示的一点问题

background-size在设定背景图片大小的时候,background-size:100% auto;若是设定百分比则回依据断在div的宽度来显示图片,所以在做图片缩放的时候百分比更本不起作用。

最好的做法是把图片的宽度设定成适合的宽度:

background-size:80px auto;

-o-background-size:80px auto;

-moz-background-size:80px auto;

-webkit-background-size:80px auto;

jquery mobile使用changePage跳转到新页面js无法执行的问题

jquery mobile 里面页面无法执行有几个可以方便的原因:

1. http://stackoverflow.com/questions/7449402/jquery-mobile-mobile-changepage-not-loading-external-js-files/7449731#7449731里面的说明,在data-role="page"以外的元素不被加载


jQuery Mobile does not pull the whole page into the dom, it grabs the first data-role="page" element and its descendants and pulls that into the current dom.

So any scripts in the <head> of the document will not be included.

I generally put all the functional JavaScript for my site on the index page and then when external pages are loaded into the dom they can benefit from the already loaded scripts.

Also, you can place JavaScript code inside the data-role="page" element and it will be included when jQuery Mobile does its AJAX load of the page.

UPDATE

A good system for this is to put all of your JS into an include file and include it on each page of the site. It will be ignored if pages are brought into the DOM by AJAX, but if someone refreshes somewhere in your site, the JS will be available.

2.链接上面要加入 rel=”external”或者data-ajax="false"来防止ajax提交

3.不使用默认的jQuery.mobile.changePage( to [, options ] )方法,使用location.href来跳转到新页面


jquery mobile的弹出框_Dialog in jquery mobile

主要弹出框分两种

1.popup弹出,这种只在本页面显示dialog

popup的事件处理

$(“#tipdialog”).on({
popupbeforeposition: function() {
var h = $(window).height();
$( “#bodybox” ).css({‘height’:h,’overflow’:’hidden’});
},
popupafterclose: function() {
$( “#bodybox” ).css({‘height’:’auto’,’overflow’:’auto’});
}
});

2.dialog弹出,这种需要加载另外的页面

Rain CSS框架基础类名简写_Use abbreviation class name in Rain CSS Framework

一直以来都有一个问题,rain css框架的类名过长,导致页面的class内容特别多,如:<input type=’button’ class=’heightM widthM css3_roundS css3_gradient_blue button blueButton’ value=’button’/>

现在个人将所有长类名增加了一个缩写,页面class内容长度可大大缩短:

<input type=’button’ class=’heightM rounds gb btn bluebtn’ value=’button’/>

不过还有个问题就是使用者不明白的短类名的由来,也就不会直接书写(需要查阅css文件),不过现成的各个模块的示例可以在控制台直接查看代码并复制代码来使用。

框架的github地址: https://github.com/RainZhai/Rain-CSS-Framework

[caption id=”attachment_194” align=”alignnone” width=”697” caption=”rain css 框架首页”]rain css 框架首页[/caption]

关于类名的设计的一点规律:

类名虽然简化了,但是还是很容易使用,如width-10(宽度100像素)简写成了w-10,而textAlignCenter(文本居中)则简写成了tac,很明显,类名简写成了每个单词的首字母,并且每个字母都为小写.部分示例代码如下:

.fn,.fontNormal{ font-style:normal;}
.fi,.fontItalic{ font-style:italic;}
.fo,.fontOblique{ font-style:oblique;}
.fv,.fontVariant{ font-variant:small-caps;}
.fwn,.fontWeightNormal{ font-weight:normal;}
.bord,.fontBord{ font-weight:bold;}
.strong{ font-weight:bold;}
.border,.fontBorder{ font-weight:bolder;}
.lighter,.fontLighter{ font-weight: lighter;}
.fsxxs,.fontsizeXxsmall{ font-size:xx-small;}
.fsxs,.fontsizeXsmall{ font-size: x-small;}
.fss,.fontsizeSmall{ font-size: small;}
.fsm,.fontsizeMedium{ font-size: medium;}
.fsl,.fontsizeLarge{ font-size: large;}
.fsxl,.fontsizeXlarge{ font-size: x-large;}
.fsxxl,.fontsizeXxlarge{ font-size: xx-large;}
.fs-1,.fontsize-1{ font-size: 1em;}

简单的Jquery Tabs插件_Simply jquery tabs plugin

很早的时候个人写了一个tabs效果插件,但是使用起来繁杂,不够简单,于是作了新的改动,现在使用非常的简便。

[caption id=”attachment_189” align=”alignnone” width=”633” caption=”jquery tabs plugin效果图”]jquery tabs plugin效果图[/caption]

javascript调用如下:

$(‘.tabswrap-1’).tabs();

html则只需要符合一定的格式带有li标签和div标签即可:

<div class=’tabswrap-1’>
<ul class=’listStyleNo noPadding noRightMargin borderBottom heightL clearfix’>
<li class=’left marginBottomNeg-1 marginRightSS bgWhite displayBlock border noBottomBorder css3_round_topS textDecNone paddingLeft paddingRight itemColorBlack’ href=’#’>Home</li>
<li class=’left marginBottomNeg-1 marginRightSS bgWhite displayBlock css3_round_topS textDecNone paddingLeft paddingRight itemLightGrey itemColorBlack’ href=’#’>Profile</li>
<li class=’left marginBottomNeg-1 bgWhite displayBlock css3_round_topS textDecNone paddingLeft paddingRight itemLightGrey itemColorBlack’ href=’#’>Messages</li>
</ul>

<div class=’c_tabpanel’ id=’tab-0’ >
<h2>this is home detail.</h2>
</div>

<div class=’c_tabpanel hide’ id=’tab-1’ >
<h2>this is Profile detail.</h2>
</div>

<div class=’c_tabpanel hide’ id=’tab-2’ >
<h2>this is Messages detail.</h2>
</div>
</div>

新tabs插件的代码如下:

$.fn.extend({
tabs : function(obj) {
var o = $.extend({
tabSelector:null,
panelSelector:null,
‘event’:”click”,
currentClass:’’,
hoverClass:’’
}, obj || {});
var _this =$(this),
//tab 的钩子
temp_tab = o.tabSelector || ‘li’,
//受控的id开头
temp_panel = o.panelSelector || ‘div’,
tabsize = $(temp_tab).length,
//tab触发事件
tabE = o.event || ‘click’,
//当前tablink的样式类
tabClass = o.currentClass,
//未选中tablink的hover类
hoverClass = o.hoverClass;
_this.children(temp_panel).hide();
$(_this.children(temp_panel)[0]).show();
_this.find(temp_tab).bind(tabE,function(){
if(tabsize>0){
$(temp_tab).removeClass(tabClass).addClass(hoverClass);
$(this).addClass(tabClass).removeClass(hoverClass);
var i = $(this).index();
_this.children(temp_panel).hide();
$(_this.children(temp_panel)[i]).show();
}
});
return _this;
}
});

html5游戏松鼠蹦蹦蹦_HTML5 game jumping squirrel

个人使用QuarkJS开发了一款小游戏《松鼠蹦蹦蹦》,支持ios端,安卓端和pc端。打开链接地址就可以在浏览器里面直接玩起来,并且同时支持横屏和竖屏。

游戏地址: http://www.webdevelopmentmachine.com/demo/game.html
安卓版本客户端下载地址: 松鼠蹦蹦蹦安卓版下载
欢迎大家对游戏提出意见,各种改进:)

[caption id=”attachment_183” align=”alignnone” width=”639”]松鼠蹦蹦蹦游戏图片 松鼠蹦蹦蹦游戏图片[/caption]

读书笔记

jj:320623198811292501
ph:15298805212