Last active
May 31, 2018 02:03
-
-
Save ifirmawan/5fb789041efa4f9ac3230f3294225302 to your computer and use it in GitHub Desktop.
Group section with odd even method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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