Есть ли способ дублировать действия функции alert () без всплывающего окна?Это может показаться сумасшедшим, но для этого есть веская причина.
РЕДАКТИРОВАТЬ
Вот мой код:
var navActive;
var pageID;
var maxNav;
var popWidth = $(window).width();
var popHeight = $(window).height();
function thread_start(callback) {
setTimeout(callback, 1);
return true;
}
(function($){
$.fn.foneySlide = function ( options ) {
$(window).resize(function(){
popWidth = $(window).width() - 40;
popHeight = $(window).height() - 40;
})
opt = $.extend ({ popOnTransition : true }, options);
// firstly give all navigation items a position reference for continous slide
$('[data-role=page]').each(function(i){
$(this).attr('navpos', i );
if( typeof $('[data-role=page]')[i+1] == 'undefined' ) {
maxNav = i;
}
});
// get the current active page and the default navigation position
pageID = $('.ui-page-active').attr('id');
navActive = $('#' + pageID).attr('navpos');
// change page on swipe left
$('body').bind('swipeleft', function(e){
if( navActive == maxNav ) {
navActive = 0;
alert();
thread_start("$.mobile.changePage($('[navpos=0]'), 'slide', false, true)");
}else{
navActive = Number(navActive + 1);
alert();
thread_start("$.mobile.changePage($('[navpos=' + navActive + ']'), 'slide', false, true)");
}
});
// change page on swipe right
$('body').bind('swiperight', function(e){
if( navActive == 0 ) {
navActive = maxNav;
alert();
thread_start("$.mobile.changePage($('[navpos=' + navActive + ']'), 'slide', true, true)");
}else{
navActive = Number(navActive - 1);
alert();
thread_start("$.mobile.changePage($('[navpos=' + navActive + ']'), 'slide', true, true)");
}
});
}
}) (jQuery);
удаляет оповещения и начинает зависать.