From b505678f896daead73eafebd8b4d1c519dbad103 Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Mon, 9 Mar 2015 20:52:55 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=BE=D0=B2=D1=8B=D0=B9=20=D0=B2=D0=B0?= =?UTF-8?q?=D1=80=D0=B8=D0=B0=D0=BD=D1=82=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80?= =?UTF-8?q?=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=84=D0=BE=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B0=D0=BC=D1=8B=20-=20=D1=87=D1=83=D1=82=D1=8C=20?= =?UTF-8?q?=D0=BB=D1=83=D1=87=D1=88=D0=B5=20=D0=B4=D0=BB=D1=8F=20=D0=BC?= =?UTF-8?q?=D0=BE=D0=B1=D0=B8=D0=BB=D1=8C=D0=BD=D1=8B=D1=85=20=D0=B4=D0=B5?= =?UTF-8?q?=D0=B2=D0=B0=D0=B9=D1=81=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ground/views/modals/image.php | 3 +-- ground/views/point.php | 2 +- public/css/style.css | 22 +++++++++------- public/js/app.js | 48 ++++++++++++++++++++++++++++++----- public/js/map.js | 7 ++--- 5 files changed, 60 insertions(+), 22 deletions(-) diff --git a/ground/views/modals/image.php b/ground/views/modals/image.php index 13a6e39..3b3f31a 100644 --- a/ground/views/modals/image.php +++ b/ground/views/modals/image.php @@ -6,8 +6,7 @@ diff --git a/ground/views/point.php b/ground/views/point.php index eff09db..4de3683 100644 --- a/ground/views/point.php +++ b/ground/views/point.php @@ -32,7 +32,7 @@ img): ?>

-
+
img): ?> diff --git a/public/css/style.css b/public/css/style.css index 3483107..0b9dbcc 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -103,7 +103,6 @@ div#box {background-image: url('/img/back.png'); background-repeat: no-repeat; b .modal-content { width: 100%!important; height: 100%!important; - /*margin: 0!important;*/ } .modal-header { @@ -126,12 +125,17 @@ div#box {background-image: url('/img/back.png'); background-repeat: no-repeat; b } } -/* Target landscape smartphones, portrait tablets, narrow desktops */ -@media screen and (max-width:768px) { -/* .leaflet-popup { - width: 100%!important; - height: 100%!important; - margin: 0!important; - }*/ -} +@media screen and (max-width:815px) { + body { + padding: 0!important; + } + div.container{ + padding: 5px; + } + + div.header a img { + width: 115px; + height: 69px; + } +} diff --git a/public/js/app.js b/public/js/app.js index 05e5108..68d29aa 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -1,4 +1,4 @@ -/* +/* * Приложение */ @@ -99,14 +99,12 @@ function showImage(id) } }); - $('.fotorama').fotorama({data: photos}); - } else - { + initFotorama('.fotorama', photos); + } else { + $('#imageModalImg').attr('src', point.img); $('#imageModalImg').show(); $('.fotorama').hide(); - $('#imageModalImg').attr('src', point.img); } - $('#imageModal').modal('show'); } @@ -157,7 +155,7 @@ window.addEventListener('popstate', function(e) lat = e.state.lat; lng = e.state.lng; zoom = e.state.zoom; - + myMap.setView([lat, lng], zoom); } else if (e.state.hasOwnProperty('route')) @@ -441,3 +439,39 @@ function filter() } } +$(document).ready(function(){ + if ($('.dfotorama').length >= 1) { + initFotorama('.dfotorama'); + + $(window).on("orientationchange", function (event) { + $('.dfotorama').data('fotorama').destroy(); + initFotorama('.dfotorama'); + }); + } +}); + +function initFotorama(selector, data){ + width = $(window).width() < 585 ? $(window).width()-10 : 555; + height = $(window).width() < 585 ? ((450/555)*($(window).width()-10)) : 450; + + if($(window).height() < height ) { + height = $(window).height(); + width = (555/450)*height; + } + + width = Math.round(width); + height = Math.round(height); + + if (typeof data !== 'undefined') { + $(selector).fotorama({ + data: data, + width: width, + height: height + }); + } else { + $(selector).fotorama({ + width: width, + height: height + }); + } +} diff --git a/public/js/map.js b/public/js/map.js index fa907f7..d779cff 100644 --- a/public/js/map.js +++ b/public/js/map.js @@ -1,4 +1,4 @@ -/* +/* * Let's GO! */ @@ -214,8 +214,10 @@ function showInfo(id) } description += '
'; + maxWidth = $(window).width() < 500 ? $(window).width() : 500; + maxHeight = $(window).height() < 300 ? $(window).height() : 300; marker.options.description = description; - marker.bindPopup(marker.options.description, {maxWidth: 500, minWidth: 400,maxHeight: 300}); + marker.bindPopup(marker.options.description, {maxWidth: maxWidth, minWidth: 400,maxHeight: maxHeight}); markers.zoomToShowLayer(marker, function () { marker.openPopup(); @@ -236,7 +238,6 @@ function showInfo(id) history.pushState({pointId: id}, document.title, "/?point=" + id); document.title = points[id].options.title; -// marker.openPopup(); } }