February 27, 201016 yr Hello all, Does anyone know of Jquery tabs that load content separately? I.e. clicking on a new tab will load that when clicked as opposed to loading all the content for all tabs at the beginning? Thanks Bk7
February 27, 201016 yr Not sure that any tabs plugin has that functionality built in, but you could just load the content via Ajax when the tab is clicked?
February 27, 201016 yr Author Not sure that any tabs plugin has that functionality built in, but you could just load the content via Ajax when the tab is clicked? Hey, thanks for the fast reply. Is it possible to direct me to somewhere that can tell me how to load the content through Ajax? Also, it is important that the content still shows if Javascript is disabled for some reason and that it degrades gracefully. Thanks
February 27, 201016 yr Not exactly sure what you mean but if the content needs to be there if javascript is disabled, AJAX is the wrong way to go about it. In that situation, the content needs to be in the page already, not fetched as required. Mark up the page with html/css first with all the content visible. Then use javascript to show/hide as needed. That way, your content will always be accessible.
February 28, 201016 yr Author Not exactly sure what you mean but if the content needs to be there if javascript is disabled, AJAX is the wrong way to go about it. In that situation, the content needs to be in the page already, not fetched as required. Mark up the page with html/css first with all the content visible. Then use javascript to show/hide as needed. That way, your content will always be accessible. Thats a fair comment. Ive done more research and still got nowhere - it might help if I explain fully. I'm using a tumblr badge to retrieve posts from my tumblr blog. Because tumblr doesn't offer a way of organising posts in collections by month, ive created 3 badges which pull posts from different months based on tags, eg january posts are all tagged january, etc etc and the script pulls the specific month only. This script is called inside a standard <div> and the js constructs the relevant html from the tumblr api. I want to create tabs for each month, but I want a way of only loading the content for each tab as its called, not all at once. So to summarise, a tab which loads content as each tab is opened?
February 28, 201016 yr Not exactly sure what you mean but if the content needs to be there if javascript is disabled, AJAX is the wrong way to go about it. In that situation, the content needs to be in the page already, not fetched as required. Mark up the page with html/css first with all the content visible. Then use javascript to show/hide as needed. That way, your content will always be accessible. Most people have Javascript turned on, so always shying away from AJAX because of "they might have it turned off" is an invalid reason. In any case you would always want to write it so if they do have it turned off, load the content as normal, but if they do have it turned on... load it AJAX. Not that hard. To the OP, jQueryUI has some documentation on how you can use AJAX with their tabs. http://jqueryui.com/demos/tabs/#ajax
February 28, 201016 yr Author Thanks everyone for their help. I've hit a fundamental stumbling block with what I'm trying to achieve, related specifically to the tumblr-badge script that I am using. Because the script is not called as a function, it cannot support multiple badges on the same page load. Unless anyone following this is familiar with: http://h4nne5.tumblr.com/post/172444646/some-work-on-tumblrbadge and the original: http://robertnyman.com/2008/09/19/tumblrbadge-a-tumblr-badge-script/ and how I can modify it to call multiple badges, this just isnt going to work! Thanks again, its been educational!
February 28, 201016 yr Most people have Javascript turned on, so always shying away from AJAX because of "they might have it turned off" is an invalid reason. In any case you would always want to write it so if they do have it turned off, load the content as normal, but if they do have it turned on... load it AJAX. Not that hard. To the OP, jQueryUI has some documentation on how you can use AJAX with their tabs. http://jqueryui.com/demos/tabs/#ajax Let's not get confused between Javascript and AJAX. I'm not saying "don't use javascript", I'm saying don't use AJAX in this situation. If bk7 wants the content to be available to users without javascript, the content must already be on the page. Yes, you can then show/hide that content with javascript but AJAX (interacting/pulling data from a server is unnecessary) as the content is already there. so always shying away from AJAX because of "they might have it turned off" is an invalid reason. In my humble opinion, the use of and dependancy on javascript is a very valid reason to reevaluate your site. Make your site work on a basic level.Enhance it with javascript wherever you like. But in this situation, there is no need for AJAX (per bk7's requirements) Having said that, the jquery link given above is great
February 28, 201016 yr Author Didn't mean to start such a debate haha! You are right, need for ajax per my requirement may have been unnecessary - but it was derived out of a need to call each page into a main page independently - such that the tumblr badge would generate the html for each blog as it was called rather than all at once. Like I said before though, I'm currently limited by the badge rather then the tabs plugins - although the Jquery UI was a great shout indeed.
Create an account or sign in to comment