Open Specific tab from External link using customjs

2 replies · opened Mar 9, 2018

JJohfradKMar 9, 2018

Hi guys,

within your doucmentation and the topic Open Tab From External Link you explain that by using the "customjs" you are able to open a specific tab from an external link.

My Goal is to open a specific tab on a page when I click on link from the menu/navigation and if I understand it correctly I need to use the method mentioned above.

Exactly as described within the documentation I added the "customjs" and the script to a tab but unfortunately it did not work. Just to be sure that I made no mistake I copied the example script from the documentation and added it to a page and tested it but also here the same behavior (jumping in the page when a tab is selected and the layout is not working properly). Click here for a live example. Open the page and go to the tab below the text "With Top Border".

Am I doing something wrong or do I have a mistake in my code?

Example code from your documentation:


 
    
        
- [Tab 1](#tab-1)
        
- [Tab 2](#tab-2)
        
- [Tab 3](#tab-3)
    
 
    
 
        
            This is Tab 1 Content
        
        
            This is Tab 2 Content
        
        
            This is Tab 3 Content
        
 
    
 

 

    jQuery(document).ready( function($){
        $( "#tabs" ).tabs({
            collapsible: true,
            event: 'mouseover',
            show: {
                effect: "fade",
                duration: 400
            }
        });
    });

Code from live example:


	
		
- [](#tabs-29)
		
- [Nunc tincidunt](#tabs-30)
		
- [Proin dolor](#tabs-31)
		
- [Aenean lacinia](#tabs-32)
	

	

		
			Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.
		
		
			Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.
		
		
			
Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent eu risus hendrerit ligula tempus pretium. Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus.

			Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.
		
		
			Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.
		
	

    jQuery(document).ready( function($){
        $( "#tabs" ).tabs({
            collapsible: true,
            event: 'mouseover',
            show: {
                effect: "fade",
                duration: 400
            }
        });
    });
JJohfradKMar 9, 2018

screenshot was to big :-)

SSemicolon WebSTAFFMar 9, 2018

Hello,

The Code you are using is incorrect! The HTML ID of you Tab is #tab-8, however, you are using $( "#tabs" ) in the Tabs JS Initialization Code. You will need to change it to #tab-8 to make it work. Additionally, this method will not work if you are trying to use the Primary Menus to link to the Tabs on the same page. You will need to use the Tabs API: https://api.jqueryui.com/tabs/ in order to make this work. However, if you are linking from an external page, the above will work perfectly fine.

Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard