Bestfit mode now actually working
This commit is contained in:
parent
99f6dc1504
commit
a01c9ca3b7
2 changed files with 32 additions and 10 deletions
19
sahli.coffee
19
sahli.coffee
|
|
@ -94,16 +94,27 @@ class @Sahli
|
|||
$('h6').hide()
|
||||
$('body').scrollTop 0
|
||||
@origwidth = picdata.width
|
||||
@origheight = picdata.height
|
||||
|
||||
@bestfit = =>
|
||||
viewbox = $('div#sahliviewer')
|
||||
if $('div.scrolly').hasClass('image')
|
||||
if $('div.scrolly').hasClass('bestfit')
|
||||
$('div.scrolly').removeClass 'bestfit'
|
||||
if $('div.scrolly').hasClass('bestfitMode')
|
||||
$('div.scrolly').removeClass 'bestfitMode'
|
||||
$('div.scrolly').addClass 'fullwidthMode'
|
||||
$('div.scrolly').width @origwidth
|
||||
$('div.scrolly').height("")
|
||||
$('img.bestfit').addClass 'fullwidth'
|
||||
$('img.bestfit').removeClass 'bestfit'
|
||||
else
|
||||
$('h6').hide()
|
||||
$('div.scrolly').addClass 'bestfit'
|
||||
$('div.scrolly').width("");
|
||||
$('div.scrolly').addClass 'bestfitMode'
|
||||
$('div.scrolly').removeClass 'fullwidthMode'
|
||||
$('div.scrolly').width window.innerWidth
|
||||
$('div.scrolly').height window.innerHeight
|
||||
$('img.fullwidth').addClass 'bestfit'
|
||||
$('img.fullwidth').removeClass 'fullwidth'
|
||||
##$('div.scrolly').width("");
|
||||
|
||||
@loadhugeansi = (picdata, inserthere) ->
|
||||
fname = @location + '/' + picdata.file
|
||||
|
|
|
|||
23
sahli.js
23
sahli.js
|
|
@ -103,18 +103,29 @@ l__________/__________|___|______l__________j_____j
|
|||
inserthere.after(pdiv);
|
||||
$('h6').hide();
|
||||
$('body').scrollTop(0);
|
||||
return this.origwidth = picdata.width;
|
||||
this.origwidth = picdata.width;
|
||||
return this.origheight = picdata.height;
|
||||
};
|
||||
|
||||
Sahli.bestfit = function() {
|
||||
var viewbox;
|
||||
viewbox = $('div#sahliviewer');
|
||||
if ($('div.scrolly').hasClass('image')) {
|
||||
if ($('div.scrolly').hasClass('bestfit')) {
|
||||
$('div.scrolly').removeClass('bestfit');
|
||||
return $('div.scrolly').width(Sahli.origwidth);
|
||||
if ($('div.scrolly').hasClass('bestfitMode')) {
|
||||
$('div.scrolly').removeClass('bestfitMode');
|
||||
$('div.scrolly').addClass('fullwidthMode');
|
||||
$('div.scrolly').width(Sahli.origwidth);
|
||||
$('div.scrolly').height("");
|
||||
$('img.bestfit').addClass('fullwidth');
|
||||
return $('img.bestfit').removeClass('bestfit');
|
||||
} else {
|
||||
$('h6').hide();
|
||||
$('div.scrolly').addClass('bestfit');
|
||||
return $('div.scrolly').width("");
|
||||
$('div.scrolly').addClass('bestfitMode');
|
||||
$('div.scrolly').removeClass('fullwidthMode');
|
||||
$('div.scrolly').width(window.innerWidth);
|
||||
$('div.scrolly').height(window.innerHeight);
|
||||
$('img.fullwidth').addClass('bestfit');
|
||||
return $('img.fullwidth').removeClass('fullwidth');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue