I love this module, and came up with two minor enhancements that I use. Maybe this is useful for others, or can be part of the module.

Both for apachesolr_ajax.ks

1. "themable" spinner

    if (spinner) {
      if (content) {
        $(content).html('<div id="spinner"><img class="spinner" /></div>');
        $('img.spinner').attr('src', spinner);
      }
    }

This puts the image in a div#spinner, so you can style the spinner box. (I use it to center the spinner)

2. For pagination and clicking links: slide the page up before posting the ajax, just like the Views module ajax pagers:
Just after the "if (spinner) {" and before the "$.post(Drupal.settings.basePath ...", place this code:

      // @ajax_views.js
      target = '#col1';
      var offset = $(target).offset();
      var scrollTarget = target;
      while ($(scrollTarget).scrollTop() == 0 && $(scrollTarget).parent()) {
        scrollTarget = $(scrollTarget).parent()
      }
      
      if (offset.top - 10 < $(scrollTarget).scrollTop()) {
        $(scrollTarget).animate({scrollTop: (offset.top - 10)}, 1000);
      }

I hardcoded my target #col1, but this could be a custom module setting. It should be the top of the main content area.

So what this does is, if you click a result pager or facet link, and you are below the top of #col1, then the page will scroll back up first, then submit ajax. This makes the user experience a bit nicer.

Hope someone can use this.

CommentFileSizeAuthor
#1 854556.patch2.91 KBjpmckinney

Comments

jpmckinney’s picture

Status: Active » Fixed
StatusFileSize
new2.91 KB

Committed. Put #col1 in Drupal.settings.apachesolr_ajax.target (a new config setting).

jpmckinney’s picture

Oops, that patch was for the wrong branch. I've fixed it in HEAD, too, now.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.