Архив

Архив раздела ‘Javascript’
20 сентября 2019 Нет комментариев
n=parseFloat(n.toFixed(1));
Categories: Javascript Tags:
10 августа 2019 Нет комментариев
var owl=$('#owl');
owl.owlCarousel({
	loop:true,
	margin:0,
	items:1,
	dots:true,
	nav:true,
	navText:['<i class="fa fa-angle-left"></i>','<i class="fa fa-angle-right"></i>'],
});
owl.on('changed.owl.carousel',function(e){
	$('.counter span').text(e.page.index+1);
});
<div class="owl-carousel owl-theme" id="owl">
	<?php
	foreach($items as $item){?>
		<div class="item"></div>
	<?}?>
</div>
<div class="counter"><span>1</span> | <?=count($items)?></div>
Categories: Javascript Tags: ,

Использовать 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>
<?}?>
Categories: Javascript, PHP Tags: ,
$("a[href$='.jpg'],a[href$='.jpeg'],a[href$='.png'],a[href$='.gif']").fancybox({
	helpers:{title:{type:'over'}},
	padding:'0',
	afterShow:function(){
		$('.fancybox-wrap').touchwipe({
			wipeLeft:function(){$.fancybox.next();},
			wipeRight:function(){$.fancybox.prev();},
			preventDefaultEvents:false,
		});
	}
});

https://www.netcu.de/jquery-touchwipe-iphone-ipad-library

Categories: Javascript Tags:
$('.block').each(function(){
	if($(this).find('.content').html()==''){
		$(this).hide();
	}
});
Categories: Javascript Tags:

Применить стили к :before (1200 — ширина рабочей области)

$(window).load(function(){
	var half=(parseInt($(window).width())-1200)/2;
	$('head').append('<style>.title:before{width:'+(half-15)+'px;left:-'+half+'px;}</style>');
});
Categories: CSS, Javascript Tags: ,

Javascript:

$('#owl_1').owlCarousel({
	loop:true,
	margin:0,
	items:1,
	nav:false,
	dots:false,
	autoplay:true,
	autoplayTimeout:500,
	animateOut:'fadeOut',
	animateIn:'fadeIn',
});

Less:

#owl_1{
	.animated{
		-webkit-animation-duration:0ms;
		animation-duration:0ms;
		-webkit-animation-fill-mode:both;
		animation-fill-mode:both;
	}
	.fadeOut{
		-webkit-animation-name:fadeOut;
		animation-name:fadeOut;
	}
	@-webkit-keyframes fadeOut{
		0%{
			opacity:0;
		}
		100%{
			opacity:0;
		}
	}
	@keyframes fadeOut{
		0%{
			opacity:0;
		}
		100%{
			opacity:0;
		}
	}
}
Categories: CSS, Javascript Tags: