Event Target not working to close element

h ttp://ans o niat hem e.tem pla tes.fina lsit e.com/

Open it up on an actual phone, and then on your desktop. Click the facebook icon and it should open up. Now, to close that, I have it set to either click the element again to close, or click out of it. Works great on desktop. Mobile it refuses to recognize I clicked out of it.

$("body:not(.fsComposeMode) .featured").on("click", ">.fsDiv", function() {
        var _self = $(this);
        $(_self).toggleClass("open");
        if($(_self).hasClass("open")) {
            var _totalHeight=$(_self).find(">.fsElement > .fsElementContent").outerHeight() + $(_self).find(">.fsElement > footer").outerHeight() + 70 //padding
            $(_self).css({
                "height":_totalHeight
            });
            $(_self).find(">.fsElement").css({
                "height":_totalHeight,
                "opacity":1,
                "padding":"50px 20px 20px"
            });
        }
        else {
            $(_self).css({
                "height":0
            });
            $(_self).find(">.fsElement").css({
                "height":0,
                "opacity":0,
                "padding":0
            });
        }
    });
...
$(document).on('click', function(event) {
        if (!$(event.target).closest('.featured').length) {
            event.stopPropagation();
            alert("target");
          $(".featured > .fsDiv").css({
                "height":0
            });
            $(".featured > .fsDiv").find(">.fsElement").css({
                "height":0,
                "opacity":0,
                "padding":0
            });
            $(".featured > .fsDiv").removeClass("open");
        }
    });

Added touchend and it seems to be working now.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.