Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Performance 在ZURB基金会4点击链接时关闭下拉的最好方法是什么? 当单击ZURB基金会4下拉中的链接时,链接不会关闭下拉。 在整个站点系统性地执行此操作的最佳方法是什么_Performance_Zurb Foundation - Fatal编程技术网

Performance 在ZURB基金会4点击链接时关闭下拉的最好方法是什么? 当单击ZURB基金会4下拉中的链接时,链接不会关闭下拉。 在整个站点系统性地执行此操作的最佳方法是什么

Performance 在ZURB基金会4点击链接时关闭下拉的最好方法是什么? 当单击ZURB基金会4下拉中的链接时,链接不会关闭下拉。 在整个站点系统性地执行此操作的最佳方法是什么,performance,zurb-foundation,Performance,Zurb Foundation,我创建了以下函数来解决这个问题。 这是最好的方法,还是我遗漏了什么 $('.f-dropdown').click(function(){ if ($(this).hasClass('open')) { $('span[data-dropdown="'+$(".f-dropdown").attr('id')+'"]').trigger('click'); } }); 您可能已经在自己的代码中对其进行了更正,但如果您的网页上有多个下拉列表,则使用这种方式会

我创建了以下函数来解决这个问题。 这是最好的方法,还是我遗漏了什么

 $('.f-dropdown').click(function(){
     if ($(this).hasClass('open')) {
         $('span[data-dropdown="'+$(".f-dropdown").attr('id')+'"]').trigger('click');
     }
 });

您可能已经在自己的代码中对其进行了更正,但如果您的网页上有多个下拉列表,则使用这种方式会更好:

$('.f-dropdown').click(function() {
    if ($(this).hasClass('open')) {
         $('span[data-dropdown="'+$(this).attr('id')+'"]').trigger('click');
     }
});

您还需要将数据下拉内容属性附加到下拉列表元素


< P>我用这个来改变ZURB基金会3.2.5页中所有下拉按钮的行为。在4中没有测试过它,但由于它是一种不同的方法,所以它在这里使用

$(document).ready(function () {
        $('.button.dropdown').find('li').click(function () {
            $(this).parents('.button.dropdown')[0].click();
        });
    });

我也有同样的问题,我还注意到zurb foundation文档页面示例中显示的拆分按钮也以同样的方式工作。它们不靠近,这是zurb bug吗?我还尝试通过选择选项标签来构建下拉内容,它们的工作方式也是一样的。选择后,下拉列表保持打开状态。没有JQuery,是否无法实现此功能?我有一个angularjs/foundation组合,如果可能的话,我希望避免使用jQuery,因为从技术上讲,这不是zurb的bug,因为zurb假设我不会将它用于单页应用程序。我实际上是在用angularjs。我最终创建了一个自定义指令,以便在需要时在angularjs应用程序中使用它。