var mktdata = {}; if (mktdata.name) { $('.penny-market-name').detach(); var marketNameEl = $('').text(mktdata.name).addClass('penny-market-name').css('font-weight', 'bold'); var logo = $('.penny-header-logo').first().children('a:first').append(marketNameEl); $('#penny-market-search').data("region",mktdata.region); $('#penny-market-search').data("marketid",mktdata.id); $('#penny-market-search').data("marketname",mktdata.name); $('#penny-market-search').data("lat",mktdata.lat); $('#penny-market-search').data("lon",mktdata.lon); $('#penny-market-search').data("nonfood",mktdata.region); $('#penny-market-search').data("usercity",mktdata.city); } if (mktdata.id > 0) { $(".penny-header-icons .icon-marktsuche a, #marktinfo_xs").removeClass("penny-lightbox"); } //, $(".penny-header-icons .icon-marktsuche a").click(function(event){ showMarketInfo(event); }); /* $(".penny-header-icons .icon-marktsuche a").hover(function(event){ showMarketInfo(); }); */ var showInfo = false; $(".penny-header-icons .icon-marktsuche a,#penny-market-info").hover(function(event){ showInfo = true; showMarketInfo(event); },function(event){ showInfo = false; setTimeout(hideMarketInfo,100); }); $("#marktinfo_xs").click(function(event){ showMarketInfo(event); }); $("#penny-market-info .fa-close").click(function(){ showInfo = false; hideMarketInfo(); }); $(".penny-header-tools .btn-group li.toggle a").click(function(){ showInfo = false; hideMarketInfo(); }); function hideMarketInfo() { if (showInfo == false) { $("#penny-market-info").hide(); } //$("#penny-market-info").unbind('mouseenter').unbind('mouseleave'); } var isMKTSet = false; function showMarketInfo(event) { if (mktdata.id > 0) { event.preventDefault(); //var requestData = {'mkt': readCookieNav('marktid_reg')}; if (isMKTSet == false) { $("#pmi_name").html(mktdata.name); $("#pmi_street").html(mktdata.street); $("#pmi_zipcity").html(mktdata.zip + " " + mktdata.city); $("#pmi_opening").html(mktdata.opening); $("#pmi_route").attr("href", "https://maps.google.com/?daddr="+mktdata.lat+","+mktdata.lon); isMKTSet = true; } $("#penny-market-info").show(); /* $.ajax({ url: '/fileadmin/navigation/mkt/proxy.php', data: requestData, dataType: "html", cache: false, success: function(data) { $(".penny-header-tools").prepend(data); $("#penny-market-info").show(); } }); */ } else { console.log("not found"); } }