$(function(){ var div = $('
'); $('body').append(div); document.addeventlistener("deviceready", ondeviceready, false); var mainwidth = $('#main').width(); $('img').each(function(){ imgautowidth(this); }).on('load', function(event) { imgautowidth(this); });; function imgautowidth(el){ var $el = $(el), width = $el.width(); //console.log(width, mainwidth); if(width > mainwidth){ $el.width('100%'); if($el.width() > mainwidth){ $el.width(mainwidth); } } } /*settimeout(function(){ if(!window.isedit){ data = ['#mainmenu', '#top','#container','#banner','#bottom']; $.each(data, function(index, val) { if($(val).length<=0) return ; var maxtop = 0; if($(val+' #mobliecontrol').length > 0){ return ; } $(val+' .block').each(function(index, el) { var currtop = $(this).offset().top + $(this).height(); if(currtop > maxtop){ maxtop = currtop; } }); var oldheight = $(val).height(); var height = maxtop-$(val).offset().top; $(val).animate({height:height+'px'}); var data = {}; data.height = height; data.div = val; }); } }, 500);*/ }); function showtip(msg, timeout){ var top = 10,left; $('#mobile_mini_tip').html(msg).fadein(); left = $(window).width() / 2 - $('#mobile_mini_tip').width() / 2; $('#mobile_mini_tip').css({top:top, left:left}); settimeout(function(){ $('#mobile_mini_tip').fadeout() }, timeout?timeout:3000); } function ondeviceready() { document.addeventlistener("backbutton", onbackkeydown, false); } function onbackkeydown() { if(confirm('exit?')) navigator.app.exitapp(); } var isapp =request('isapp'); if(isapp){ setcookie('isapp', 1); } if(isapp || getcookie('isapp')) document.write(''); if($('meta[name="viewport"]').length<=0){ $('title').before(''); }