Skip to content

Instantly share code, notes, and snippets.

@ifirmawan
Last active May 31, 2018 02:03
Show Gist options
  • Save ifirmawan/5fb789041efa4f9ac3230f3294225302 to your computer and use it in GitHub Desktop.
Save ifirmawan/5fb789041efa4f9ac3230f3294225302 to your computer and use it in GitHub Desktop.
Group section with odd even method
<?php $number =1; ?>
@foreach($links as $key => $value)
@if($number % 4 == 1 )
[
@endif
<h1>{{ $number.'-' }}</h1>
@if($number % 4 == 0 && $number > 0)
]
@endif
<?php $number++; ?>
@endforeach
<script>
$('.nav-previous').click(function(){
var current = $(this).attr('id');
if (typeof current == "undefined" ) {
var number = 5;
}else{
var number = current;
if (number > 0) {
number = parseInt(number) - 4;
}
}
$(this).attr('id',number);
$('.nav-next').attr('id',number);
$(this).attr('href','#tab-'+number);
});
$('.nav-next').click(function(){
var current = $(this).attr('id');
if (typeof current == "undefined" ) {
var number = 5;
}else{
var number = current;
number = parseInt(number) + 4;
}
$(this).attr('id',number);
$('.nav-previous').attr('id',number);
$(this).attr('href','#tab-'+number);
//return false;
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment