[jQuery] multiple q:s - tab plugin and more
fellows,
finally my jquery driven findfreefonts.net site is updated - I had a picture
in my mind of how it should look and work with regards to navigation etc
(pretty much like how I do regular Windows apps). And I am getting closer.
So, flicker free "ajax paging" was the big thing to fix - and not the actual
paging but rather getting history (back etc) to work.
Now to the questions:
First some on Klaus tab plugin and history.
*******************************************
I couldn't get the history thing to work as I wanted - cause as I have
mentioned before when you step to page 2 and then click on a font (goes to
another page), then clicks "back" - you come back to page 1 - i.e the ajaxed
page2 is not what is shown.
So I needed some custom "history management" allowinf for constructs like
list.aspx#page-3, list.aspx#page-2 etc. Also I needed
list.aspx#search (activates the search tab) and list.aspx#result (same as
#page-1).
The "problem" with Klaus plugin (problem for ME and MY scenario - otherwise
it's excellent piece of work )
is that it's so tied to #thetabtoactivate . As it sets the location hash
when clicking on a tab I couldn't
implement my own scheme here.
Someone smarter than me might see some way to "fix" the plugin to work as I
wanted it - and someone even more smarter ( = I mean you Klaus, hehe :) )
might be able to see some pattern to change the code to allow for more
flexible hash management. Note, Klaus, I am not asking you to - just
suggesting a need and also asking if more people see the need for it.
The way I solved it - was to use Mikage's history plugin instead and read
the hash :
(pseudocode)
if ( hash == 'search' )
TriggerTab(1);
if ( hash == 'results' )
TriggerTab(2);
if ( hash == 'page-xxx' )
GetPageNumberByUsingAjax(xxx);
And the second part of the solution but I turned to non-jquery (forgive
me...LOL) BarelyFitz tab control.
It does not "mess" with the hash - which was what I needed.
Flickerfree Klaus tab plugin
*******************************************
I learned one more thing from BarelyFitz - and tried it with Klaus's as well
and wanted to share it with you:
in the head section - hide the tab
document.write('<style
type="text/css">#TabSelector{display:none;}<\/style>');
in document.ready - after setting up the tab
$('#TabSelector').tabs();
you show it
$('#TabSelector').show();
this will solve the problem of tab content being rendered before tabs has
been setup.
Ajax or get ???
*******************************************
my code for getting the new data when paging is as follows
function AjaxGetHTML(sUrl)
{
//alert(sUrl);
$.get(sUrl,function(result)
{
$('#loadedcontent').html(result);
SetupAjaxedContent(); // = hookup jquery handlers etc
});
}
In a "real world" scenario - is it good enough - or should I use
$.ajax and define error handlers etc. I know it's a matter of experience and
knowledge - but some sort of "best practice" would be terrific to have on
the jquery.com site.
My coding
*******************************************
I do know the JS coding on the site looks pretty bad - I am still struggling
to getting a workable model
for jquery and asp.net (with master pages) - as it is now I do get multiple
document.ready functions etc.
Just a comment on jquery.com site
*******************************************
It ties alt+f to the search box - which I find a bit irritating - as alt+f
is the shortcut to the File menu in IE.
thanks and keep up the good work everyone!
--
View this message in context: http://www.nabble.com/multiple-q%3As---tab-plugin-and-more-tf2924529.html#a8174873
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/