mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
fix(view) set current, only if height view is big enough
This commit is contained in:
parent
127d06cf64
commit
72d5841a9e
1 changed files with 18 additions and 10 deletions
|
|
@ -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',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue