-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Unable to Set Size for md-icon using Iconset and CSS Styling (when using JQuery) #1679
Comments
Close since online demos work with resizing. |
@ThomasBurleson I have discovered the situation where the md-icon resizing fails. At first, I thought it was something strange in my app environment. It turns out, it simply is the inclusion of jQuery in the webpage (which I'm using instead of jqlite). I've published a trivial example of how including jQuery in a webpage "breaks" the CSS resizing when using an iconset. material-design-broken-icon. In summary, by simply including <script src="https://code.jquery.com/jquery-2.1.3.min.js"></script> in the webpage, the icon resizing via CSS fails. I haven't dug deeper into why including jQuery causes the issue, but assume many others may be using jQuery instead of jqlite. |
@ThomasBurleson Any comment or update on this? Do you plan to re-open this issue? We've had to revert back to using individual Thanks. |
When jQuery compiles the svg elements, it changes their attributes names to lower case; Since |
Actually, the problem is with jQuery.fn.attr: jQuery should either be fixed or |
@nkoterba You can use jQuery hooks to fix jQuery handling of those attributes:
|
@dinoboff - Your input is very helpful. I think ngMaterial should compensate for these changes also. |
@ThomasBurleson If this is indeed a difference between jQuery and jQLite then using the DOM API should fix the issue. Angular 2.0 won't support jQLite anyway from what I've read. I'll create a fix and fork @dinoboff's Codepen to test it. Thanks again for tracking this down @dinoboff. |
@programmist - you rock. Thx. |
I've got a fix. I'll submit a PR shortly. See error condition here: See issue fixed here: |
@programmist - is this issue still open ? |
It's fixed and when I referenced it from my PR it added a closed label (above) that says "This issue will close once pull request #1803 is merged into the 'master' branch." Maybe that's why it still shows up as open? |
Updates code and docs. Also removes redundant function names. Fixes #1679 BREAKING CHANGE: The API has changed for `md-icon` - `iconSize` has been changed to `viewBoxSize`
Guys this is a workaround: .material-icons.md-18 { |
I'm trying to use iconsets as described on the angular material demo for md-icon.
I grabbed the demo
core-icons.svg
file.I included the following code in my angular app:
My html before styling:
Result:

Now I try to use CSS properties to resize the icon:
My html:
Result:

However, my image does not resize, the md-icon element just gets resized, clipping the md-icon.
Using the chrome inspector, we can see this:

Oddly, loading icons from svg URLs does resize the icons if we apply css styles to them:
Has anybody else experienced this or found a solution?
The text was updated successfully, but these errors were encountered: