jpopup icon indicating copy to clipboard operation
jpopup copied to clipboard

Can't scrollto into a custom anchor inside of the content of the overlay

Open huesoamz opened this issue 6 years ago • 2 comments

If the overlay have a lot of text, after create it I try to use Jquery animate after but doesnt work like:

 var jPopupDemo = new jPopup({
                            content: $('.worlds-popup').html()
                        });
                        $('html, body').velocity({
                            scrollTop: $('.JPopup '+"#"+$(this).attr('data-goto')).offset().top
                        }, 2000);

...so I extend the Jpopup like this code...but doesnt work too..

` open: function open(params) {

        jPopup(params);
    },
    goTo: function goTo(id) {
        console.log('custom '+id);
        console.log($(".jPopup #"+id).offset().top);
        var $container = $(".jPopup");
        var $scrollTo = $(".jPopup #"+id);
        $container.animate({scrollTop: $scrollTo.offset().top - $container.offset().top + $container.scrollTop(), scrollLeft: 0},300); 

        /*$('.JPopup #testID').animate({
              scrollTop: $(".jPopup #"+id).offset().top
          }, 2000);*/
    }`

Any ideas?

huesoamz avatar Sep 08 '18 03:09 huesoamz

I see you have selector $('.JPopup') instead of $('.jPopup'), that's probably the issue cause.

robiveli avatar Nov 12 '18 17:11 robiveli

@robiveli it's not the issue because you only view the example of velocity, as I sayed before I extended the function with a goTO and doesnt work...

$('#xxId').scrollTop(0); $("html, body").scrollTop($("#xxId").offset().top);

$("html, body").animate({ scrollTop: 0 }, 500); $('#xxId').animate({ scrollTop : 0 }, 'slow'); $('#xxId').animate({ scrollTop: 0 }, 'slow');

None of them work....Could you please tellme if exists a kind of solution?

huesoamz avatar Jan 25 '19 12:01 huesoamz