I have hacked it a little so that msDropDown() only get's attached once.

I did

$('#edit-lang-dropdown-select:not(.processed)').addClass('processed').msDropDown({

inside lang_dropdown.js

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lmeurs’s picture

Version: 6.x-1.7 » 7.x-2.x-dev
Issue summary: View changes
Status: Active » Needs review
FileSize
3.79 KB

There are multiple problems when AJAX is being used (or better: behaviors are being attached) on the same page with a Language Switcher Dropdown.

  1. First problem is that elements are queried for in the DOM's root and not in the by Drupal provided context, that's why these elements are initialized each time behaviors are attached.
  2. Second problem is that the counter used for the ddslick library gets reset each time behaviors are attached. This results in a the Language Switcher Dropdown only reacting on the second click after ie. an AJAX request and does not allow multiple Language Switcher Dropdown on one page.

See patch attached for Drupal 7 which added context to jQuery queries and sets an initialized flag on the

    element.
hcderaad’s picture

I can confirm the patch from #1 to work with AJAX requests in separate view on the same page. Thanks @lmeurs

hcderaad’s picture

Status: Needs review » Reviewed & tested by the community

Switched status, tested and reviewed the patch from #1.

kala4ek’s picture

Assigned: Unassigned » kala4ek

  • kala4ek committed ca6b2ef on 7.x-2.x authored by lmeurs
    Issue #1699776 by lmeurs, hcderaad, GoalGorilla, kala4ek: When using...
kala4ek’s picture

Assigned: kala4ek » Unassigned
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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