/** * @file * A JavaScript file for the theme. * * In order for this JavaScript to be loaded on pages, see the instructions in * the README.txt next to this file. */ // JavaScript should be made compatible with libraries other than jQuery by // wrapping it with an "anonymous closure". See: // - https://drupal.org/node/1446420 // - http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth (function ($, Drupal, window, document, undefined) { //version 2 // To understand behaviors, see https://drupal.org/node/756722#behaviors Drupal.behaviors.my_custom_behavior = { attach: function(context, settings) { bk_slider(); function bk_slider(){ if ($(window).width()>768){ if($("ul.slides").length > 0){ $("ul.slides li .image-slider").each(function(index) { $(this).css('background-image', 'url("' + $(this).attr("image") + '")'); }); } }else{ if($("ul.slides").length > 0){ $("ul.slides li .image-slider").each(function(index) { $(this).css('background-image', 'url("' + $(this).attr("mobile") + '")'); }); } } }//cierro bk_slider $(window).bind('resize', bk_slider); } }; })(jQuery, Drupal, this, this.document);