iphone navigation

Posted by Rona on Stack Overflow See other posts from Stack Overflow or by Rona
Published on 2012-06-16T14:57:33Z Indexed on 2012/06/16 15:16 UTC
Read the original article Hit count: 132

Filed under:
|
|
function handleClickEvent(event) {
    var linkFrom = $(event.target);
    if (typeof linkFrom.attr("href") == 'undefined') {
        linkFrom = $(event.target).parent();
    }

    var targetPage = linkFrom.attr("href");

    if (linkFrom.hasClass('submit')) {
        handleSubmitEvent(event);
        // if we want to stop processing: return false;
    }



    if (linkFrom.hasClass('backbutton')) {
        targetPage = historyStack.pop();
        if (historyStack.length == 0) {
            lastPage = "index.html";
        }

    } else {
        historyStack.push(lastPage);
    }

    lastPage = targetPage;


    $(event.target).css({
        'background-color': '#194fdb',
        'color': '#ffffff'
    });
    loadingWindowON();

    // Add new unique div    
    prevPageId = "page" + pageIdCounter;

    pageIdCounter = parseInt(pageIdCounter) + 1
    nextPageId = "page" + pageIdCounter;

    nextPageDiv = "<div id='" + nextPageId + "' class='nextpage' /></div>";

    $("body").append(nextPageDiv);

    if (linkFrom.attr("target") != "_blank") {
        event.preventDefault();

        document.getElementById(nextPageId).addEventListener('webkitAnimationEnd', function () {

            // remove prev div
            element = document.getElementById(prevPageId);
            if (element) {
                element.parentNode.removeChild(element);
            }
            // set next div as current
            document.getElementById(nextPageId).className = 'currentpage';

        }, false);

        document.getElementById(nextPageId).className += ' slideleftIn';
        document.getElementById(prevPageId).className += ' slideleftOut';

        loadContent(targetPage, nextPageId);

    }

I use this javascript with a twitter app I had to do and when I click a button, instead of sliding the new page from the side it adds it to the existing page at the bottom. It works fine when i open it on my computer using google chrome but when I try to open it with my iphone it doesn't work.

Any ideas?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about html