0

I am trying to get a div to appear when a textbox gets focus, and disappear when the textbox looses focus. This is supposed to happen on an iPad in portrait mode (hence checking if the w

/*if the search-bar looses focus*/
$("#activate-search").focusout(function(ev){
    if (w < h) {
        $(".left-pane").hide();
        $("#senior-card-container").css("margin-top", "40px");
        ev.stopPropagation();
    };
});

/*if the search-bar gets focus*/
$("#activate-search").focusin(function(){
    if (w < h) {
        $(".left-pane").show();
        $("#senior-card-container").css("margin-top", "250px");
        $(".navbar").css("position", "fixed", "top", "20px");
    };
});
  • possible duplicate of [iPad HTML Focus](http://stackoverflow.com/questions/5978470/ipad-html-focus) – Guerra Jul 30 '13 at 18:19

2 Answers2

0

Take a look here

Unfortunally it's not possible. I'm having problems with jQuery and portables too.

Community
  • 1
  • 1
Guerra
  • 2,792
  • 1
  • 22
  • 32
0

Perhaps helps something like this with the blur problem.

<input type="text" id="search" />
<input type="text" id="search2" />

var isIpad = /(iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent);
if (isIpad === true) {
    $("#search").on('click', function () {
        lastFocus = $(this).attr('id');
        checkFocusInterval = setInterval(blurIpad, 200);
    });
}

function blurIpad() {
    var focusNow = document.activeElement;
    if (focusNow.getAttribute('id') != lastFocus) {
        clearInterval(checkFocusInterval);
        alert('The iPad has left the hou.. uhhm input')    
    }
}
alexP
  • 3,672
  • 7
  • 27
  • 36