fix(view) set current, only if height view is big enough

This commit is contained in:
coderaiser 2014-04-04 07:09:28 -04:00
parent 127d06cf64
commit 72d5841a9e

View file

@ -13,25 +13,33 @@ var CloudCmd, Util, DOM, CloudFunc, $;
Key = CloudCmd.Key,
Images = DOM.Images,
View = Util.exec.bind(Util),
Element, TemplateAudio, TemplateImage,
Element, TemplateAudio,
Config = {
beforeShow : function() {
Images.hideLoad();
Key.unsetBind();
},
afterClose : function() {
beforeClose : function() {
var element, isCurrent,
overlay = DOM.getByClass('fancybox-overlay'),
position = CloudCmd.MousePosition;
inner = DOM.getByClass('fancybox-inner', overlay),
heightView = $(inner).height(),
heightWin = window.screen.height,
heightDiff = heightWin / heightView,
position = CloudCmd.MousePosition,
MAX_DIFF = 1.5;
DOM.hide(overlay);
element = DOM.getCurrentByPosition(position);
isCurrent = DOM.isCurrentFile(element);
if (!isCurrent)
DOM.setCurrentFile(element);
if (heightDiff > MAX_DIFF) {
DOM.hide(overlay);
element = DOM.getCurrentByPosition(position);
isCurrent = DOM.isCurrentFile(element);
if (!isCurrent)
DOM.setCurrentFile(element);
}
Key.setBind();
},
beforeClose : Key.setBind,
fitToView : true,
loop : false,
openEffect : 'none',