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

Trying to get full width #190

Closed
tasmanwebsolutions opened this issue Jun 23, 2016 · 5 comments
Closed

Trying to get full width #190

tasmanwebsolutions opened this issue Jun 23, 2016 · 5 comments

Comments

@tasmanwebsolutions
Copy link

tasmanwebsolutions commented Jun 23, 2016

I am using the latest version of holder.js but I am un able to use the percentage % to get full width of div? How can I get it to pic up full width of div?

<div class="head-content">
<div class="col-lg-12">
<img src="holder.js/100%x380">
</div>
</div>
@imsky
Copy link
Owner

imsky commented Jun 23, 2016

try holder.js/100px380

@tasmanwebsolutions
Copy link
Author

That worked

@imsky
Copy link
Owner

imsky commented Jun 23, 2016

excellent, glad to help 😄

@imsky imsky closed this as completed Jun 23, 2016
@SAPHemlock
Copy link

Thanks. Its working and now the holderjs image is responsive.
Can you please explain a littlebit how it worked or just general idea of the fix?

@imsky
Copy link
Owner

imsky commented Mar 18, 2021

@SAPHemlock the "p" is what makes the holder responsive, because "%" has a special meaning in URLs

so holder.js/100px380 means "create a placeholder 100% wide and 380 pixels tall"

this is processed with the fluid flag here

holder.fluid = dimensions.indexOf('p') !== -1;

and set in the DOM here

el.style.width = dimensions.width;

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

3 participants