Created
April 15, 2013 08:18
-
-
Save firhome/5386650 to your computer and use it in GitHub Desktop.
imgs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(document).ready(function(){ | |
| var setting_img = function(dom_width,allimg,scale){ | |
| var dt_width = dom_width[0].offsetWidth; | |
| if(scale){ | |
| var n1 = parseInt(scale.split(':')[0]),n2 = parseInt(scale.split(':')[1]); | |
| var img_height = (dt_width / n1) * n2; | |
| }else{ | |
| var img_height = 0; | |
| }; | |
| var imgs = allimg; | |
| imgs.each(function(i,d){ | |
| $(d).height(img_height); | |
| }); | |
| }; | |
| //最新 | |
| setting_img($('#new > dt'),$('#new > img'),'3:4'); | |
| //最热 | |
| setting_img($('#hot > dt'),$('#hot > img'),'4:3'); | |
| $(window).resize(function(){ | |
| //最新 | |
| setting_img($('#new > dt'),$('#new > img'),'3:4'); | |
| //最热 | |
| setting_img($('#hot > dt'),$('#hot > img'),'4:3'); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment