In a thumbnail website, if I want to display 100x100 thumbs on screnn resolutions lower than 1280x1024 while display 150x150 thumbs for screens higher than 1280x1024, is the following procedure correct?
- Render a page frame with no thumbs by view1()
- On page frame loaded, it detects client's screen resolution and pass it to another Django view call fetchthumb()
- View fetchthumb()开发者_开发问答 create html code containing the thumb images and return to page frame.
- jQuery on page frame render thumb html on browser.
Are there any better methods?
i think you have few options
- Just change thumbnail at runtime based on $(window).width(); using jquery
- Pass on screen resolution to django first time from client side, and later store it in session and render templates accordingly
- Sometime you may get screen resolution in request headers, i am not sure though
- Best would be to design a general solution which doesn't depend on screen resolution, and scaling 150x150 to 100x100 shouldn't be a problem on client side.
精彩评论