Skip to content

Instantly share code, notes, and snippets.

@ghostwing412
ghostwing412 / jquery.slide.mobile.css
Created November 23, 2017 07:06
mobileSlide:jquery
.MSWrapper .MSSlide {
-webkit-transition: all 0.2s 0s ease-in-out;
-moz-transition: all 0.2s 0s ease-in-out;
-ms-transition: all 0.2s 0s ease-in-out;
-o-transition: all 0.2s 0s ease-in-out;
transition: all 0.2s 0s ease-in-out;
}
.MSWrapper .MSSlide.MSSlideNA {
-webkit-transition: unset;
@ghostwing412
ghostwing412 / jquery.app_get_more_btn.js
Last active November 23, 2017 06:01
移动端向上滑动加载
/**
* 向上滑动加载更多
* DEMO <button class="ui-btn ui-corner-all get_more" data-page="2" data-url="url" data-func="loadMoreList">点击获取更多</button>
* data-page页面,data-url异步链接,data-func异步完成列表处理方法
* @requires jQuery_mobile.js
*/
;(function ($) {
$.fn.getMore = function (opts, argv) {
if($(this).length === 0){
return false;
@ghostwing412
ghostwing412 / cycle_head_pic_jquery
Last active August 26, 2015 03:20
cycle_head_picture:jquery
$.fn.cycleHeadPic = function(options){
var setting = {
class:'cycle-head-pic',
}
setting = $.extend(true, setting, options);
this.each(function(){
var cont = $('<div>').addClass(setting.class + '-cont');
var box = $('<div>').addClass(setting.class);
box.append(cont).after($(this));
cont.append($(this));
@ghostwing412
ghostwing412 / fixscreen_mobilejs
Created July 28, 2015 03:13
fixScreen:mobilejs
var fixScreen = function() {
var metaEl = doc.querySelector('meta[name="viewport"]'),
metaCtt = metaEl ? metaEl.content : '',
matchScale = metaCtt.match(/initial\-scale=([\d\.]+)/),
matchWidth = metaCtt.match(/width=([^,\s]+)/);
if ( metaEl && !matchScale && ( matchWidth && matchWidth[1] != 'device-width') ) {
var width = parseInt(matchWidth[1]),
iw = win.innerWidth || width,
ow = win.outerWidth || iw,
sw = win.screen.width || iw,
@ghostwing412
ghostwing412 / limitint_jquery
Last active August 29, 2015 14:25
limitint:jquery
$.fn.limitint = function(options){
var setting = {
limit:5
};
if(options != undefined){
setting = $.extend(setting, options);
}
this.on('blur.limitint',function(event){
var value = parseInt($(this).val());
$(this).val( (isNaN(value) || value < setting.limit) ? setting.limit : value );