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

Width update on resize #28

Open
RoffeDH opened this issue Jun 23, 2014 · 9 comments
Open

Width update on resize #28

RoffeDH opened this issue Jun 23, 2014 · 9 comments

Comments

@RoffeDH
Copy link

RoffeDH commented Jun 23, 2014

After a little headache I found the problem to the width. The original code is as follow:
[code]$this.css({width: $this.outerWidth();});[/code]
The issue with this is that upon re-sizing the window the pinned element wont re-size (like I wanted it to do.

So all I had to do was the following change:
[code]$this.css({width: $this.parent().outerWidth();});[/code]

Now, this might not be something you'd want to make happen on every instance, so maybe do it an option:

$('.pinned').pin({
resize: true
});

@MindSculpt
Copy link

I actually don't see an instance where this isn't mandatory, as it breaks on any browser resizing. +1 for adding this into the plugin permanently.

@alexslade
Copy link

👍 @RoffeDH's fix works nicely. I've issued a PR to help.

@LostSenSS
Copy link

👍

@robertwbradford
Copy link

Thanks, @RoffeDH!

@custa1200
Copy link

Any chance of getting this rolled in. It's pretty broken without it. I am trying to pin an error status bar but it breaks on resize.

@ryandury
Copy link

@RoffeDH 👍

@dannybrown73
Copy link

dannybrown73 commented Apr 6, 2016

if this is the issue i was having of the pinned item getting stuck in one spot on resize, my hacky fix for this is to reset it on window resize with:

$(window).on('resize', function(){
        $('.mypinclass').attr('style', '').removeData('pin');
        $('.mypinclass').pin();
    });

@pmdevelopment
Copy link

Maybe a better way than resetting:

$('.selector').pin({
    containerSelector: '.container'
});
$(window).on('resize', function () {
    $('.selector').width($('.container').width());
});

@ryscript
Copy link

ryscript commented Mar 9, 2020

I saw in the code that it looks addressed now, however, it didn't work as expected on my end, anyone having the same issue with the latest version? and what trick does work for you?

Thanks

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

10 participants