/** * @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) { // To understand behaviors, see https://drupal.org/node/756722#behaviors //version final2 12 de mayo. Monica Salcedo Drupal.behaviors.my_flavor_behavior = { attach: function(context, settings) { txt_flavor(); bk_flavor(); bk_productos(); function txt_flavor(){ if($(".node-type-birell").length > 0){ $(".box-bk > h2, .txt-product h3").each(function(index) { var cadena = $(this).html(), patron = " ", nuevoValor = "
", nuevaCadena = cadena.replace(patron, nuevoValor); $(this).html(nuevaCadena); }); } }//cierro funcion function bk_flavor(){ if ($(window).width()>=992){ if($(".node-type-birell").length > 0){ var $img_web=$(".node-type-birell .box-bk").attr("web"); $('.box-bk').css('background-image', 'url("' + $img_web + '")'); } }else{ if($(".node-type-birell").length > 0){ var $img_mobile=$(".node-type-birell .box-bk").attr("mobile"); $('.box-bk').css('background-image', 'url("' + $img_mobile + '")'); } } }//cierro bk_flavor //cambiar de posicicon bloque awards if($(".node-type-birell").length > 0){ $Awards=$("#block-views-birell-block-3").html(); $("#block-views-birell-block-3 ").remove(); $("#block-views-birell-block-4 .box-bk .wrapper-birell .ingredient ul").after('
'+$Awards+'
'); } //bk function bk_productos(){ if ($(window).width()>=992){ if($(".node-type-birell").length > 0){ $("#block-views-birell-block-1 .views-row").each(function(index) { var $img_web= $(this).find('.bk-product').attr("extra"); $(this).find('.bk-product').css('background-image', 'url("' + $img_web + '")'); }); } }else{ if($(".node-type-birell").length > 0){ $("#block-views-birell-block-1 .views-row").each(function(index) { var $img_mobile= $(this).find('.bk-product').attr("extra"); $(this).find('.bk-product').css('background-image', 'url("' + $img_mobile + '")'); }); } } } $(window).bind('resize', bk_flavor); $(window).bind('resize', bk_productos); }//cierro attach }; })(jQuery, Drupal, this, this.document);