Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@huesoamz

Description

@huesoamz

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions