如何在alpineJS中隐藏超出引导模式对话框的内容?

问题描述

在Bootstrap 4.5 / jquery 3.3 / alpinejs 2.2应用程序中,我显示了具有大小限制的图像 并单击图像,然后使用aplineJS方法打开模式对话框

x-on:click="show_hostel_image_modal = true"

并且可以正常打开,但是我不喜欢对话框后面的所有内容都是可见的。 是否有一种方法可以隐藏它,而无需调用bootstrap js方法,就像我从jquery方法中移出一样?

我有:

@if(!empty($currentHostelImage))
    <div
        x-data="{ show_hostel_image_modal: false,hostelImages: <?php print prepareEncodeArray($hostelImages) ?>,current_image_id:
{{$currentHostelImage->id }},currentImage : {{$currentHostelImage }} } "
        class="hostel_images_block_wrapper">
        
        
        <div
            class="modal_editor_container p-2"
            x-show="show_hostel_image_modal"
            @click.away="show_hostel_image_modal = false"
        >
            <div
                class="modal_editor_title"
            >
                <h4 class="modal-title p-2">
                    {!! $viewFuncs->showAppIcon('image') !!}Image view : <span x-html="currentImage.filenameData.image"></span>
                    <button class="close" type="button" x-on:click="show_hostel_image_modal= false">
                        <i class="test-device p-2 pl-4 pr-4 m-0"></i>
                        <span aria-hidden="true">&times;</span>
                    </button>
                </h4>
            </div> <!-- modal_editor_title -->
            
            <div class="modal_editor_fields" :style="'max-height: ' + ( modalHeight() - 20 ) +'px; '">
                <div x-show="typeof currentImage.filenameData != 'undefined'">
                    <img :src="currentImage.filenameData.image_url" class="hostel_dialog_image m-1 p-1"
                    
                         :class="{ 'hostel_image' : true }"
                    >
                    
                    <div class="alert alert-info" role="alert">
                        {!! $viewFuncs->showAppIcon('info') !!}
                        <span x-html="currentImage.filenameData.file_info"></span>
                    </div>
                
                </div> <!-- <div> -->
            </div>  <!-- modal_editor_fields-->
            
            
        
        </div> <!-- <div class="modal_editor_container"> -->
        
        
        <template x-for="nextHostelImage in hostelImages">
            <div class="hostel_view_current_image_wrapper" x-show="current_image_id === nextHostelImage.id ">
                <img :src="nextHostelImage.filenameData.image_url" class="hostel_view_current_image"
                     :alt="nextHostelImage.filenameData.file_info" x-on:click="show_hostel_image_modal = true" data-toggle="tooltip"
                     data-placement="top" title="Click to view in full size">
            </div>
        </template>
    
    
    </div>
@endif

和样式:

.modal_editor_container {
  width: 90%;// !important;
  top: 20px;
  left: 50px;
  position: absolute;
  z-index: 900;
  flex: 1;
  flex-direction: column;
  justify-items: flex-start;
  padding: 0;
  margin: 0;// !important;
}

已修改: 我试图按照导航导航菜单中的步骤进行操作。

请您看看https://jsfiddle.net/z83m7fnc/

我只需要注意hostel_images_block_wrapper-这是所有图像块和 模态对话框的modal_editor_container类。

谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)