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

One special situation that $('#container').trigger('refreshWookmark') does not work. I have already resolved. It may help you. #231

Open
feng9017 opened this issue May 11, 2017 · 1 comment

Comments

@feng9017
Copy link

Thank the author for contributing this plugin! I appreciate it that the author make so much effort to this little and helpful one! I like it !
I am dealing a bug .

function collapse(element) {
        if ($(element).hasClass("collapsed")) {
            $(element).removeClass("collapsed")
            $(element).addClass("collapse")
            $(element).html("fold")
            $(element).siblings(".duplicatefriend.toCollapse").fadeIn();
        } else {
            $(element).removeClass("collapse")
            $(element).addClass("collapsed")
            $(element).html("unfold")
            $(element).siblings(".duplicatefriend.toCollapse").fadeOut();
        }
        $('#searchTable').trigger('refreshWookmark');
    }

When the 'element' has class 'collapsed', click it. $('#searchTable').trigger('refreshWookmark') ;" works normally. But when the 'element' has html 'unfold', click it. $('#searchTable').trigger('refreshWookmark') ;" does not work.

I check the code careful . Finally find that the element's attribute "data-wookmark-height" doesn't change when I click it which hasn't class "collapsed". But it's strange that the element's attribute "data-wookmark-height" changes when I click it which has class "collapsed". I don't have enough time to check the source code. I guess the attribute "data-wookmark-height" is relevant to "refreshWookmark" working or not.
At last I realize that the functions "fadeIn" and "fadeOut" working needs some time. This may cause "refreshWookmark" couldn't detect the change to the item. So I change "fadeIn" and "fadeOut" to "show" and "hide". It works finally.
But this cannot answer Why "refreshWookmark" when the element has function "fadeIn" works normally.
I expect that the author or others could make some response to me! It cannot be better any more that if our author make change in the next version.

@Sebobo
Copy link
Member

Sebobo commented May 11, 2017

Hi,

try running refreshWookmark in the next rendered frame. Either with setTimeout or requestAnimationFrame.
That could perhaps help.

Or you can maybe also hide and show your other elements with css instead of jQuery, as jQuery changes more than only the opacity during the animation.

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