Bahh, I've found a bug.  In the code when I get type, I check to see
if type == "whatever".  But it seems if my links have more than 1
class, it fails.  For example my code may have <a
href="/admin/posts/add" class="add admin-link">Add Post</a> - this is
ignored.

Whats the best way to check to see if a link contains the class,
without doing a == selection on it?

Tane

On 4/17/07, digital spaghetti <[EMAIL PROTECTED]> wrote:
Hi Sean,

Thanks, that seems to have done the trick - although it broke the Tabs
plugin I was using in my admin interface.  I've created a workaround
and this works perfectly:

function hijackLinks(root) {
 $('a',root).click(function(){
        var type = $(this).attr('class');
        if (type == "admin-link") {
                // If admin link, load into sub-admin area
                $('.admin-area').load(this.href,function(){
        hijackLinks($('.content')); });
                return false;
        } else if (type == "no-ajax") {
                // If no ajax link, ignore
        } else {
                // Normal content area link
                $('.content').load(this.href,function(){
        hijackLinks($('.content')); });
                return false;
        }
        });
}

$(document).ready(function() {
       hijackLinks(document);
});



Tane

On 4/17/07, Sean Catchpole <[EMAIL PROTECTED]> wrote:
>
> Hi Tane,
>
> > function hijackLinks(root) {
> > $('a',root).bind('click', function(){
> >        $('.content').load(this.href);
> >        return false;
> > });
> > };
>
> I would change this function to this instead of doing all that ajaxStart/Stop:
> function hijackLinks(root) {
>   $('a',root).click(function(){
>     $('.content').load(this.href,function(){
>       hijackLinks($('.content')); });
>     return false; });
> }
>
> Then you only need to run your: $(function(){ hijackLinks(document); }
>
> ~Sean
>

Reply via email to