From f54e6b18f3e2620f77e1cde0eb2fbf2a264c037b Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Fri, 18 May 2018 13:10:49 -0400 Subject: [PATCH] setting up default tabs --- rooms.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/rooms.php b/rooms.php index beaae4f..8ace70c 100644 --- a/rooms.php +++ b/rooms.php @@ -13,7 +13,6 @@ get_header(); $slug = $post->post_name; $content = apply_filters('the_content', $post->post_content); ?> -
@@ -100,14 +99,26 @@ get_header(); // active: 1, // heightStyle: "content" // }); + let tab = 0; + const slug = ''; + const rooms = jQuery('#rooms-tabs').children('ul').children('li'); + rooms.each(function(index, value){ + let room = jQuery(this).children('a').text().toLowerCase() + room = room.substr(0, room.indexOf(' ')); + if( slug.indexOf(room) !== -1 && room){ + tab = jQuery(this).index(); + } + }) + jQuery( ".room-amenities" ).accordion({ collapsible: true, active: false, heightStyle: "content" }); jQuery( "#rooms-tabs" ).tabs({ - active: 1 + active: tab }); + });