jquery tabs not working using BBQ plugin -
i have question... , problem.
i'm using bens hashchange.js make links www.site.com/abc.php#123.php tract history between tabs.
that works great, have tab plug-in inside of 123.php works great if access page via www.site.com/123.php, if try access page hashchange links tabs become broken.
this tab code:
$(".tab_content").hide(); //hide content $("#files_left_pane > ul.tabs li:first").addclass("active").show(); //activate first tab $("#files_right_pane > .tab_content:first").show(); //show first tab content //on click event $("#files_left_pane > ul.tabs li").click(function() { $("#files_left_pane > ul.tabs li").removeclass("active"); //remove "active" class $(this).addclass("active"); //add "active" class selected tab $("#files_right_pane > .tab_content").hide(); //hide tab content var activetab = $(this).find("a").attr("href"); //find href attribute value identify active tab + content $(activetab).fadein(); //fade in active id content return false; });
based off of don't see checking windows.hash anything, i'm not sure why js isn't being applied script.
this js hashchange events:
var newhash = "", $maincontent = $("#main-content"), $pagewrap = $("#wrap"), baseheight = 0, $el; $pagewrap.height($pagewrap.height()); baseheight = $pagewrap.height() - $maincontent.height(); $("#nav_profile_menu").delegate("a", "click", function() { window.location.hash = $(this).attr("href"); return false; }); $(window).bind('hashchange', function(){ newhash = window.location.hash.replace( /^#/, '' ); if (newhash) { $maincontent .find("#content-fill") .fadeout(200, function() { $maincontent.hide().load(newhash + " #content-fill", function() { $pagewrap.animate({ height: baseheight + $maincontent.height() + "px" }); $maincontent.fadein(900); }); }); }; }); $(window).trigger('hashchange');
by skimming these codes , scenario problem be?
i'm thinking js code isn't being applied new dom elements being created via ajax hashchange.js plugin.
if thats case, how can trigger js apply newly created content?
you need use .live
or .delegate
add action listeners items loaded in after initial load of page.
check em out on jquery docs
Comments
Post a Comment