簡體   English   中英

Onclick幻燈片到當前div

[英]Onclick slide to current div

當前,主頁上有各行,每行都有一個按鈕。 單擊該按鈕時,div將向上滑動到頁面頂部。 但是與此同時,按鈕上還添加了另一個操作。 以下是我的js代碼:

$( ".expandable-container-mobile").click(function() {

            var el = $(this).find('.mobile-show-section');//get the current element
            var el2 = $(this).find('.expandable');

            el.stop().slideToggle(700);//toggle the current one 
            $(this).children('.expandable').toggleClass('clicked');  


            $('.expandable').not(el2).removeClass('clicked');
            $('.mobile-show-section').not(el).stop().slideUp();//hide the rest

        });

我正在使用scrollify js $ .scrollify.move(“#name”); 但它似乎不適用於div-section-name,也可以通過其他方法來實現。

使用jQuery,一段代碼-

 function scrollToAnchor(aid){
     //get the element to be scrolled
     var el = $(this).find('.mobile-show-section');
     //then scroll it using jQuery annimation
     $('html,body').animate({scrollTop: el.offset().top},500);
  };

看到我的一些答案,

ANSWER1

ANSWER2

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM