20 сентября 2019
Нет комментариев
n=parseFloat(n.toFixed(1));
n=parseFloat(n.toFixed(1));
Использовать javascript: window.top.location.href
Например вместо:
header("Location: ".$result_data->response->body->url_login);
указать:
header("Location: /?goto=".$result_data->response->body->url_login);
и на самой странице:
<?php if(isset($_GET['goto'])){?> <script> window.top.location.href="<?=$_GET['goto']?>"; window.location.href="<?=$_GET['goto']?>"; </script> <?}?>
Когда, к примеру, input checkbox невидим, а вместо него отображается иконка font awesome или др. и нужно проверить его checked и т.д.
Не использовать display:none
или visibility:hidden
Использовать, например, opacity:0;
Убрать атрибут readonly="readonly"
и добавить class="readonly"
, и js:
$(".readonly").on('keydown paste',function(e){ e.preventDefault(); });
ymaps.ready(init); function init(){ var placemarks=[]; var myMap=new ymaps.Map("places_map",{ center:[59.952236, 30.299258], zoom:16, controls:['zoomControl'] }); Placemark=new ymaps.Placemark([59.952236, 30.299258],{ balloonContent:'address 1', hintContent:'name 1', },{ preset:'islands#redDotIcon' }); placemarks[1]=Placemark; myMap.geoObjects.add(Placemark); Placemark=new ymaps.Placemark([59.924406, 30.385793],{ balloonContent:'address 2', hintContent:'name 2', },{ preset:'islands#redDotIcon' }); placemarks[2]=Placemark; myMap.geoObjects.add(Placemark); Placemark=new ymaps.Placemark([59.952236, 30.299258],{ balloonContent:'address 3', hintContent:'name 3', },{ preset:'islands#redDotIcon' }); placemarks[3]=Placemark; myMap.geoObjects.add(Placemark); myMap.behaviors.disable('scrollZoom'); $('.places_map .places .item').on('click',function(){ $('.places_map .places .item').removeClass('active'); $(this).addClass('active'); $('.places_map .places').addClass('closed'); var cid=$(this).data('id'); myMap.setCenter(placemarks[cid].geometry.getCoordinates()); //placemarks[cid].balloon.open(); }); }
<script src="https://api-maps.yandex.ru/2.1/?lang=ru_RU"></script> <div class="places_map"> <div id="places_map"></div> <div class="places"> <div class="items"> <div class="item" data-id="1">title 1</div> <div class="item" data-id="2">title 2</div> <div class="item" data-id="3">title 3</div> </div> </div> </div>
#places_map{ height:500px; }
Например:
$(document).on('mouseover','.q',function(e){ $('#'+$(this).data('tip')).fadeIn(); }); $(document).on('mouseout','.q',function(e){ $('#'+$(this).data('tip')).fadeOut(); });
Вместо:
$('.q').hover(function(){ $('#'+$(this).data('tip')).fadeIn(); },function(){ $('#'+$(this).data('tip')).fadeOut(); });
function replaceAll(str,find,replace){ return str.replace(new RegExp(find,'g'),replace); }
Например, удалить проблемы во всех input в форме:
$("form input[type=text]").each(function(){ $(this).val(replaceAll($(this).val(),' ','')); });