admin管理员组文章数量:1122846
Im wanting to force a page to load and have a particular dynamic tab as active.
Here’s the context: As seen the “Artworks” screen dumps below when a course is selected screen 1 displays with the focus on the dynamic tab “Overview” which is good at this point. The user then clicks the “Curriculum” tab and the content for this tab is then displayed on the same page as the “Overview”, screen2. The user then selects the appropriate lesson, and a new page is displayed, screen 3. The lesson page has a button that when pressed takes the user back to the Course Summary screen 1. However, this time I want the the “Curriculum” tab and content to be active.
I have a filter in a functions php file that currently triggers after (can be before if needed) the summary page is loaded and its in there I thought I’d put the solution script.
function psb_main_content_func( ){
echo ('hello from the main content hook!');
echo "
<script>
.... something goes in here ...
</script> ";
}
add_filter( 'learn-press/after-main-content', 'psb_main_content_func' );
That’s not the problem though. The problem is that I don’t know how to force screen 1 to load with “Curriculum” tab and content as active. Even using the browser inspect console I cant get it to go correctly. I’ve tried various combinations of getElement…. tried removing and adding the .active class.
Here are the relevant elements
Can someone can point me in right direction please. Thanks Paul
Im wanting to force a page to load and have a particular dynamic tab as active.
Here’s the context: As seen the “Artworks” screen dumps below when a course is selected screen 1 displays with the focus on the dynamic tab “Overview” which is good at this point. The user then clicks the “Curriculum” tab and the content for this tab is then displayed on the same page as the “Overview”, screen2. The user then selects the appropriate lesson, and a new page is displayed, screen 3. The lesson page has a button that when pressed takes the user back to the Course Summary screen 1. However, this time I want the the “Curriculum” tab and content to be active.
I have a filter in a functions php file that currently triggers after (can be before if needed) the summary page is loaded and its in there I thought I’d put the solution script.
function psb_main_content_func( ){
echo ('hello from the main content hook!');
echo "
<script>
.... something goes in here ...
</script> ";
}
add_filter( 'learn-press/after-main-content', 'psb_main_content_func' );
That’s not the problem though. The problem is that I don’t know how to force screen 1 to load with “Curriculum” tab and content as active. Even using the browser inspect console I cant get it to go correctly. I’ve tried various combinations of getElement…. tried removing and adding the .active class.
Here are the relevant elements
Can someone can point me in right direction please. Thanks Paul
Share Improve this question asked May 9, 2024 at 6:04 pbeepbee 52 bronze badges1 Answer
Reset to default 0It seems like a tab is made active by the associative radio input
element being checked. Thus, you'd want to select the tab-curriculum-input
input
element and set it to checked:
document.getElementById('tab-curriculum-input').checked = true
本文标签: How to force a page to load and have a particular dynamic tab as active
版权声明:本文标题:How to force a page to load and have a particular dynamic tab as active 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736307746a1933419.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论