Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function swap(x,y){
- var temp = $('img:eq('+x+')').attr('src');
- var temp2 = $('img:eq('+y+')').attr('src');
- $('img:eq('+y+')').attr('src',temp);
- $('img:eq('+y+1+')').attr('src',temp);
- $('img:eq('+x+')').attr('src',temp2);
- $('img:eq('+x+1+')').attr('src',temp2);
- }
- function hw(x){
- return $('img:eq('+x+')').height()/$('img:eq('+x+')').width();
- }
- function getNew(){
- var images = document.getElementsByClassName('img-responsive');
- var size = images.length;
- for (var x=0; x<size; x=x+2){
- for (var y=0; y<size-2; y=y+2){
- if(hw(y)>hw(y+2)){
- swap(y,y+2);
- console.log(y);
- console.log(y+2);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment