dd
Showing
1 changed file
with
49 additions
and
3 deletions
| ... | @@ -194,6 +194,7 @@ | ... | @@ -194,6 +194,7 @@ |
| 194 | 194 | ||
| 195 | 195 | ||
| 196 | function changePdfOptions(json) { | 196 | function changePdfOptions(json) { |
| 197 | jQuery(function($) { | ||
| 197 | json = JSON.parse(json); | 198 | json = JSON.parse(json); |
| 198 | 199 | ||
| 199 | 200 | ||
| ... | @@ -204,7 +205,7 @@ | ... | @@ -204,7 +205,7 @@ |
| 204 | var pdflist = ""; | 205 | var pdflist = ""; |
| 205 | var pdfChange = ""; | 206 | var pdfChange = ""; |
| 206 | var f = 0; | 207 | var f = 0; |
| 207 | console.log(json[0].pheight ,json[0].pwidth); | 208 | |
| 208 | if(json[0].pwidth > 300){ | 209 | if(json[0].pwidth > 300){ |
| 209 | var scaleImage = 300 / json[0].pwidth; | 210 | var scaleImage = 300 / json[0].pwidth; |
| 210 | var imageHeight = json[0].pheight * scaleImage; | 211 | var imageHeight = json[0].pheight * scaleImage; |
| ... | @@ -242,16 +243,56 @@ | ... | @@ -242,16 +243,56 @@ |
| 242 | strVar2 += ' <div class="callout primary"><div class="row column"><h1>Welcome to Synapsus Online PDF Editor</h1>'; | 243 | strVar2 += ' <div class="callout primary"><div class="row column"><h1>Welcome to Synapsus Online PDF Editor</h1>'; |
| 243 | strVar2 += '<p class="lead">Please make your changes or return <a href="#" onclick="location.reload();">back to the list</a></p>'; | 244 | strVar2 += '<p class="lead">Please make your changes or return <a href="#" onclick="location.reload();">back to the list</a></p>'; |
| 244 | strVar2 += ' </div></div><div id="wrapper" class="row small-up-2 medium-up-3 large-up-3">'; | 245 | strVar2 += ' </div></div><div id="wrapper" class="row small-up-2 medium-up-3 large-up-3">'; |
| 245 | strVar2 += pdflist + '<div id="changesColumn" class="column" >' + pdfChange + '</div><div id="pdfFooter"></div></div>'; | 246 | strVar2 += pdflist + '<div id="changesColumn" style="height:'+$("#changes").height()+';" class="column" >' + pdfChange + '</div><div id="pdfFooter"></div></div>'; |
| 246 | 247 | ||
| 247 | 248 | ||
| 248 | 249 | ||
| 249 | document.getElementById('contentArea').innerHTML = strVar2; | 250 | document.getElementById('contentArea').innerHTML = strVar2; |
| 250 | document.getElementById('google_drive').innerHTML = " "; | 251 | document.getElementById('google_drive').innerHTML = " "; |
| 251 | 252 | ||
| 252 | jQuery(function($) { | 253 | |
| 254 | console.log($("#pdfPreview").height() ,$("#changes").height()); | ||
| 255 | |||
| 256 | if($("#pdfPreview").height() > $("#changes").height()){ | ||
| 257 | $('#changesColumn').css('position' ,'relative'); | ||
| 258 | var stickySidebar = $('#changesColumn'); | ||
| 259 | |||
| 260 | if (stickySidebar.length > 0) { | ||
| 261 | var stickyHeight = stickySidebar.height(), | ||
| 262 | sidebarTop = stickySidebar.offset().top; | ||
| 263 | } | ||
| 253 | 264 | ||
| 265 | // on scroll move the sidebar | ||
| 266 | $(window).scroll(function () { | ||
| 267 | if (stickySidebar.length > 0) { | ||
| 268 | var scrollTop = $(window).scrollTop(); | ||
| 254 | 269 | ||
| 270 | if (sidebarTop < scrollTop) { | ||
| 271 | stickySidebar.css('top', scrollTop - sidebarTop); | ||
| 272 | |||
| 273 | // stop the sticky sidebar at the footer to avoid overlapping | ||
| 274 | var sidebarBottom = stickySidebar.offset().top + stickyHeight, | ||
| 275 | stickyStop = $('#pdfPreview').offset().top + $('#pdfPreview').height(); | ||
| 276 | if (stickyStop < sidebarBottom) { | ||
| 277 | var stopPosition = $('#pdfPreview').height() - stickyHeight; | ||
| 278 | stickySidebar.css('top', stopPosition); | ||
| 279 | } | ||
| 280 | } | ||
| 281 | else { | ||
| 282 | stickySidebar.css('top', '0'); | ||
| 283 | } | ||
| 284 | } | ||
| 285 | }); | ||
| 286 | |||
| 287 | $(window).resize(function () { | ||
| 288 | if (stickySidebar.length > 0) { | ||
| 289 | stickyHeight = stickySidebar.height(); | ||
| 290 | } | ||
| 291 | }); | ||
| 292 | |||
| 293 | }else{ | ||
| 294 | |||
| 295 | console.log('false'); | ||
| 255 | var stickySidebar = $('#pdfPreview'); | 296 | var stickySidebar = $('#pdfPreview'); |
| 256 | 297 | ||
| 257 | if (stickySidebar.length > 0) { | 298 | if (stickySidebar.length > 0) { |
| ... | @@ -286,6 +327,11 @@ $(window).resize(function () { | ... | @@ -286,6 +327,11 @@ $(window).resize(function () { |
| 286 | stickyHeight = stickySidebar.height(); | 327 | stickyHeight = stickySidebar.height(); |
| 287 | } | 328 | } |
| 288 | }); | 329 | }); |
| 330 | |||
| 331 | } | ||
| 332 | |||
| 333 | |||
| 334 | |||
| 289 | 335 | ||
| 290 | 336 | ||
| 291 | 337 | ... | ... |
-
Please register or sign in to post a comment