Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function resizePage(id) {
- var doc_width = jQuery(document).width();
- var page_width = parseInt(pages[id].width);
- var page_height = parseInt(pages[id].height);
- var nice_width = 980;
- var perfect_width = 980;
- if(doc_width > 1200) {
- nice_width = 1120;
- perfect_width = 1000;
- }
- if(doc_width > 1600) {
- nice_width = 1400;
- perfect_width = 1300;
- }
- if(doc_width > 1800) {
- nice_width = 1600;
- perfect_width = 1500;
- }
- if(doc_width > 2400) {
- nice_width = 2200;
- perfect_width = 2100;
- }
- if (page_width > nice_width && (page_width/page_height) > 1.2) {
- if(page_height < 1610) {
- width = page_width;
- height = page_height;
- }
- else {
- height = 1600;
- width = page_width;
- width = (height*width)/(page_height);
- }
- jQuery("#page").css({'max-width': 'none', 'overflow':'auto'});
- jQuery("#page").animate({scrollLeft:9000},400);
- jQuery('#page .inner .preview img').attr({width:width, height:height});
- jQuery("#page .inner img.open").css({'max-width':'99999px'});
- jQuery('#page .inner img.open').attr({width:width, height:height});
- if(jQuery("#page").width() < jQuery("#page .inner img.open").width()) {
- isSpread = true;
- create_message('is_spread', 3000, 'Tap the arrows twice to change page');
- }
- else {
- jQuery("#page").css({'max-width': width+10, 'overflow':'auto'});
- isSpread = false;
- delete_message('is_spread');
- }
- }
- else{
- if(page_width < nice_width && doc_width > page_width + 10) {
- width = page_width;
- height = page_height;
- }
- else {
- width = (doc_width > perfect_width) ? perfect_width : doc_width - 10;
- height = page_height;
- height = (height*width)/page_width;
- }
- jQuery('#page .inner .preview img').attr({width:width, height:height});
- jQuery('#page .inner img.open').attr({width:width, height:height});
- jQuery("#page").css({'max-width':(width + 10) + 'px','overflow':'auto'});
- jQuery("#page .inner img.open").css({'max-width':'100%'});
- isSpread = false;
- delete_message('is_spread');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement