Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
huesoamz opened this issue Sep 8, 2018 · 2 comments

Comments

@huesoamz
Copy link

huesoamz commented Sep 8, 2018

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?

@robiveli
Copy link
Owner

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

@huesoamz
Copy link
Author

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants