0
어떤 이유로 든 자바 스크립트를 통해 초기화 할 때 스크롤 막대가 나타나지 않지만 HTML을 통해 초기화 할 수 있습니다.mCustomScrollbar 스크롤 애니메이션 비활성화
#popup-scroll
의 스크롤 막대는 php
내용을 나타냅니다. 이것은 갤러리 내부에 있으며 팝업은 루프의 각 항목에 대한 라이트 박스 역할을합니다. 자바 스크립트에 의해 초기화
<?php
$the_query = new WP_Query(array(
'post_type' => 'post')); while ($the_query->have_posts()) : $the_query->the_post();?>
<?php
echo'<figure><a class="popup-with-zoom-anim" href="#'.$post->post_name.'">'.the_post_thumbnail().'<div class="title"><h2>'.$post->post_title.'</h2></div></a></figure>';
echo'<div id="'.$post->post_name.'" class="zoom-anim-dialog mfp-hide">
<div id="popup-scroll">'.$content.'</div></div>'; ?>
<?php endwhile; wp_reset_postdata(); ?>
(작동하지 않습니다) :
<script>
(function($){
$(window).on("load",function(){
$("#popup-scroll").mCustomScrollbar({scrollInertia: 0});
});
})(jQuery);
</script>
을 (작품) HTML에 의해 초기화 :
<div id="popup-scroll" class="mCustomScrollbar" data-mcs-theme="dark">
<!-- the content -->
</div>
목표는 스크롤 애니메이션 scrollInertia: 0
을 비활성화하는 것입니다, 이는 단지 수 javascript 초기화를 통해 완료하십시오.
The developer site, for reference