[support] Problem with Drupal.behaviors

Jeff Greenberg listmail.ayendesigns at gmail.com
Sun Apr 28 02:24:37 UTC 2013


I'm using a js file with a handful of jQuery functions wrapped in
Drupal.behaviors to move, retag or alter some items on the Commerce product
detail page and collection page.

The issue I have is that the final function does not fire. If I take it,
replace the $'s in it with jQuery and paste it in the console of firebug or
chrome tools, it works just fine (it rewraps the page title).

The js contents are below. The page is:
http://testing.ayendesigns.com/xooples/skincare



(function ($) {
  Drupal.behaviors.moveWishlist = {
    attach: function(context, settings) {
      $('<div class="wish-list"></div>').once('moveWish', function() {
        $(this).appendTo('form.commerce-add-to-cart > div');
        $('.node-product-display li.flag-wish_list').appendTo('ul.links');
      })
    }
  };
  Drupal.behaviors.moveAddThis = {
    attach: function(context, settings) {
      $('<li
class="addthis"></li>').once('addthis1').appendTo('.node-product-display
ul.links');
      $(".node-product-display a[href^='http://www.addthis
']").once('addthis2').appendTo('li.addthis');
    }
  };
  Drupal.behaviors.moveLinks = {
    attach: function(context, settings) {
      $('.node-product-display .group-right
ul.links').once('addthislinks').appendTo('.node-product-display div#tabs');
    }
  };
  Drupal.behaviors.moveTrending = {
    attach: function(context, settings) {

$('li.flag-trending').once('moveTrending').appendTo('.node-product-display
ul.links');
    }
  };
  Drupal.behaviors.titleTag = {
    attach: function(context, settings) {
        $('body.page-node
header').find('h2').once('titleTag').replaceWith(function() {
            return '<h1 class="field-name-title-field">' + $(this).text() +
'</h1>';
        });
    }
  };
  Drupal.behaviors.categoryPage = {
    attach: function(context, settings) {
      $('.page-product-category
.view-display-id-page').once('categoryPage', function()
{$(this).find('div.taxonomy-title').replaceWith(function() {
          return '<h1 class="taxonomy-title"><span>' + $(this).text() +
'</span></h1>';
        });
    })}
  };
 })(jQuery);


-- 
---
drupal.org/user/367108
linkedin.com/in/jeffrgreenberg
accidentalcoder.com / ayendesigns.com
@accidentalcoder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20130427/0c8445a7/attachment.html 


More information about the support mailing list