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

img width 100% event #1044

Closed
gertcuykens opened this issue Dec 21, 2014 · 1 comment
Closed

img width 100% event #1044

gertcuykens opened this issue Dec 21, 2014 · 1 comment

Comments

@gertcuykens
Copy link

Click on the red square and see the console log output

http://jsbin.com/penega

How can I get rid of this setTimeout hack to get the correct 100% width of a image?

I tried core-animated-pages-transition-end still needed time out hack :P

PS also notice the fixed bug when trying other animations :)

         <polymer-element name="to-soon" attributes="activePage">
          <template>
            <img src="http://sea-is-snow.appspot.com/icon/loading.gif" style="width:100%">
            <span style="color:green; position:fixed; bottom:0px; right:0px; z-index:1;">TO SOON</span>
          </template>
          <script>
            Polymer({
              activePageChanged: function(){
                if (this.activePage!=1) return 0
                console.log(this.shadowRoot.querySelector('img').width)
                setTimeout(function(){ // <=== HACK
                    console.log(this.shadowRoot.querySelector('img').width)
                }.bind(this), 500);
               },
            });
          </script>
        </polymer-element>

(http://stackoverflow.com/questions/27592169/img-width-100-event)

@gertcuykens
Copy link
Author

Miss spelled the event listener... doh!

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

1 participant