Both history plug-ins apply the onclick logic for you.

<http://www.mikage.to/jquery/jquery_history.html>
With Mikage's history plug-in you'll need a pageload function (see the
source code) and edit it according to the hash values of your anchor tags.
I'd recommend replacing his if(hash) statement with a switch(hash) statement
if you're going to be handling each hash differently. However, note in the
"off-course" part of this thread another user mentioned having trouble with
IE7 and Mikage's plug-in. YMMV.

<http://stilbuero.de/jquery/history/>
Klaus' more recent history plug-in looks much more like jQuery syntax. You
target an anchor tag using regular old jQuery selectors and the .history
method takes a function as its parameter. So an anchor tag like:

<a id="linkToHome" href="#home">Home</a>

...could be accessed using:
$('#linkToHome').history( showHome() );

Klaus' history plug-in also has a built in "remote" method that pulls the
HTML file that is linked to in the anchor tag. You can use that if it works
better in your situation.

Good luck,
Brian.


On Wed, Nov 26, 2008 at 6:46 AM, OhNoMrBill <[EMAIL PROTECTED]> wrote:

>
> I am bounding this follow-on question up...thread kind of went off
> course.
>
> The bit about links makes sense; but then how do I bind the javacsript
> onclick functions to the links?
>
>
> On Nov 24, 5:29 am, OhNoMrBill <[EMAIL PROTECTED]> wrote:
> > That makes sense; but then how do I bind the functions to the links?
> >
> > The functions represent a large block of black-boxed code that is an
> > AJAX handler that pushes content into destination divs.
> >
> > On Nov 24, 2:52 am, "Brian Cherne" <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > Take a look at the history plug-in page code again:
> > > <http://www.mikage.to/jquery/jquery_history.html>
> >
> > > A really important concept to understand is that the history plug-in
> (any
> > > history plug-in) is listening / watching for the URL to change. Any
> change
> > > you want it to make going "Back" you will need to let it make going
> > > "Forward" (and on click) as well. You basically relinquish control to
> the
> > > history plug-in (actually to the "pageload" function if you're
> following the
> > > example URL to the letter). It works like this:
> >
> > > - user clicks link with an #home href
> > > - url changes to page.html#home
> > > - history plug-in notices url change, calls pageload function
> > > - pageload function does something based on "home"
> >
> > > - user clicks link with an #products href
> > > - url changes to page.html#products
> > > - history plug-in notices url change, calls pageload function
> > > - pageload function does something based on "products"
> >
> > > - user clicks browser's Back button
> > > - url changes to page.html#home
> > > - history plug-in notices url change, calls pageload function
> > > - pageload function does something based on "home"
> >
> > > - user clicks browser's Forward button
> > > - url changes to page.html#products
> > > - history plug-in notices url change, calls pageload function
> > > - pageload function does something based on "products"
> >
> > > I hope this makes sense. You will need to:
> >
> > > 1) remove the inline onclick for each of your links. That overrides the
> > > history plug-in and you won't be able to work around it (cleanly).
> >
> > > 2) make the href hash values different for each of your links.
> >
> > > So, instead of:
> > > <a href="#" onclick="showHome()">Home</a>
> >
> > > You'll need something more like:
> > > <a href="#home">Home</a>
> > > <a href="#products">Products</a>
> >
> > > I hope this helps.
> >
> > > Brian.
> >
> > > On Sun, Nov 23, 2008 at 10:51 PM, OhNoMrBill <[EMAIL PROTECTED]>
> wrote:
> >
> > > > Anyone have an ideal on this?
> >
> > > > On Nov 22, 8:15 pm, OhNoMrBill <[EMAIL PROTECTED]> wrote:
> > > > > I am in a real bind on this issue. Is anyone able to answer? Help
> > > > > would be greatly appreciated if you can!!
> >
> > > > > On Nov 22, 10:50 am, OhNoMrBill <[EMAIL PROTECTED]> wrote:
> >
> > > > > > Here is the scenario I am trying to deal with currently:
> >
> > > > > > I have a link that looks like:
> >
> > > > > > <a href="#" onClick="$.Content_Home();">Some Link</a>
> >
> > > > > > All the url links in this site look like this...onclick
> overrides.
> >
> > > > > > What I need to do is ensure that when a user clicks back, the
> actual
> > > > > > prior jQuery function is called, and not the entire page.
> >
> > > > > > I tried the history plugin, and can not seem to get it to pick
> this
> > > > > > kind of thing up. Anyone with direct experience on this kind of
> thing,
> > > > > > please chime in with some suggestions.- Hide quoted text -
> >
> > > > > - Show quoted text -- Hide quoted text -
> >
> > > - Show quoted text -- Hide quoted text -
> >
> > - Show quoted text -
>

Reply via email to