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

Support for 2x & 3x through data attributes #283

Open
brentdodell opened this issue Aug 14, 2017 · 3 comments
Open

Support for 2x & 3x through data attributes #283

brentdodell opened this issue Aug 14, 2017 · 3 comments

Comments

@brentdodell
Copy link

I didn't know if there was a better place to ask questions.

Is there a way to manually specifying both 2x & 3x versions through data attributes? The following example given in the README seems to only support one. I used rails with digested assets and would prefer not to generate non-digested assets, but would also like to support 2x & 3x. Thanks!

<img
  src="/images/my_image.png"
  data-rjs="/images/2x/my-image.png" />
@husseycoding
Copy link

There doesn't appear to be way to do this that I have found either (if you define the attribute twice then only one is used of course) - however if you set a 3x image as the path, then it will also be used for 2x retina. I'm not entirely sure if there are any issues with this as I don't have a 3x retina device to test on, but I can say that all looks ok in 2x and 3x retina in responsive design mode of a standard desktop browser.

@glaliberte
Copy link

I needed something like that too and saw that this issue was opened since August 14.

I coded a little solution for one of my project on a fork:
https://github.com/glaliberte/retinajs#manually-specifying-multiple-high-res-url

@TongDaDa
Copy link

You can use the browser devicePixelRatio for judgment Const DPR = window. DevicePixelRatio | | 1 Of course, if it is never too, trouble.But seems there is no other way, or you can rewrite the retina, js

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

4 participants