【问题标题】:Fire jquery function after Foundation Reveal has openedFoundation Reveal 打开后触发 jquery 函数
【发布时间】:2018-10-29 09:58:20
【问题描述】:

我正在使用Foundation's Reveal 打开一个模态,如何在模态打开后触发以下代码?

jQuery(document).foundation();

// Ensure all product code cells are the same height
$('.product-codes').each(function(){
  // Cache the highest
  var highestBox = 0;
  // Select and loop the elements you want to equalise
  $('.column-data', this).each(function(){
    // If this box is higher than the cached highest then store it
    if($(this).height() > highestBox) {
      highestBox = $(this).height();
    }
  });
  // Set the height of all those children to whichever was highest
  $('.column-data',this).height(highestBox);
});

【问题讨论】:

    标签: jquery zurb-foundation


    【解决方案1】:

    你需要在open.zf.reveal事件上调用你的函数

    jQuery(document).on('open.zf.reveal',function(){
    
    // Ensure all product code cells are the same height
    $('.product-codes').each(function(){
      // Cache the highest
      var highestBox = 0;
      // Select and loop the elements you want to equalise
      $('.column-data', this).each(function(){
        // If this box is higher than the cached highest then store it
        if($(this).height() > highestBox) {
          highestBox = $(this).height();
        }
      });
      // Set the height of all those children to whichever was highest
      $('.column-data',this).height(highestBox);
    });
    
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多