Anyone? Could it maybe be possible to adjust History/Remote to do this? Thanks, Frizzle.
On Feb 11, 1:26 pm, frizzle <[EMAIL PROTECTED]> wrote: > Thanks for your reply oliver. > No offence, but i kinda was heading this way, until i realized that it > wouldn't solve my back/forward buttons problem, > since the event would only be called by a click on a link... > > (Though your approach looks a lot better then mine...) > > Thanks, > Frizzle. > > On Feb 11, 9:00 am, oliver <[EMAIL PROTECTED]> wrote: > > > That function is only firing once, when the DOM is ready. You want it > > to fire every time one of your links is clicked, so add a click > > handler to each of them. Inside of that handler, don't look at the > > location, instead look at the href of the clicked item and extract > > that hash. > > > Assuming a like looks like this: > > <a href="#foo">bar</a> > > > $(document).ready(function() { > > $('#files a').click(function(event) { > > $("#files").load("index.php?explore=" + > > this.href.substring(1)); > > }); > > > }); > > > The problem is that when #files get loaded with new data, those click > > handlers won't be on the new items; so a better approach would be to > > just add one click handler to the parent and inspect the target: > > > $(document).ready(function() { > > $('#files').click(function(event) { > > if (event.target.href) { > > $(this).load("index.php?explore=" + > > event.target.href.substring(1)); > > } > > }); > > > }); > > > o > > > On Feb 10, 9:05 am, frizzle <[EMAIL PROTECTED]> wrote: > > > > Hi there, > > > > I have some links on a page inside <div id="files"></div>. > > > They link to the same page, but with a different hash. > > > The hash should define what url will be loaded into #files. > > > > I have the script below: > > > > <script type="text/javascript"> > > > $(function() { > > > $('#files').load("index.php? > > > explore="+location.hash.substring(1)); > > > }); > > > </script> > > > > It works when someone goes to the page with a defined hash, or if you > > > refresh the page with a certain hash, > > > but just by clicking the links and back/forward in the browser it > > > won't work. The script doesn't get fired again.. > > > > I hope this is clear. > > > > Thanks, > > > Frizzle.