Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const arrayDays = []
- for (let i = {{ firstDay }}; i <= {{ lastDay }}; i++) {
- arrayDays.push(i);
- }
- let arrayIndex = 0;
- $('.up-arrow').click(function(){
- if (arrayIndex === 0) {
- arrayIndex = arrayDays.length-1
- } else {
- arrayIndex = arrayIndex -1
- }
- handleDays(arrayIndex)
- })
- $('.down-arrow').click(function(){
- if (arrayIndex === arrayDays.length-1) {
- arrayIndex = 0
- } else {
- arrayIndex = arrayIndex + 1
- }
- handleDays(arrayIndex)
- })
- handleDays = (index) => {
- console.log(index)
- for (let i = {{ firstDay }}; i <= {{ lastDay }}; i++) {
- $('div[data-day]').css('display', 'none')
- $('.schedule-page_controls_header_day').text(arrayDays[index].toString())
- $('div[data-day='+arrayDays[index]+']').css('display', 'flex')
- }
- }
- handleDays(arrayIndex)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement