A
A
anikitin352014-12-09 08:46:54
Drupal
anikitin35, 2014-12-09 08:46:54

How to adapt java script for drupal 7?

Good afternoon!

With the first part of the document, everything seems to be clear.
Wrapped in Drupal standard (function ($) { }(jQuery));
When it comes to functions that come after the first part of the document, nothing works.
Should they be adapted in some way?

Document structure:

jQuery(document).ready(function($){
         var .......

         $test.on('click', function(event){
    event.preventDefault();
    $menu_navigation.removeClass('speed-in');
    toggle_panel_visibility($lateral_cart, $shadow_layer, $('body'));
  });
});

function toggle_panel_visibility ($lateral_panel, $background_layer, $body) {
  if( $lateral_panel.hasClass('speed-in') ) {
    // firefox transitions break when parent overflow is changed, so we need to wait for the end of the trasition to give the body an overflow hidden
    $lateral_panel.removeClass('speed-in').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(){
      $body.removeClass('overflow-hidden');
    });
    $background_layer.removeClass('is-visible');
.................................

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tennalian, 2014-12-09
@anikitin35

And not a lot of closing brackets after onclick?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question