Rev839, Fix sidebar after browser resize
This commit is contained in:
parent
7d35797749
commit
e296ee7ebb
3 changed files with 37 additions and 4 deletions
|
@ -8,6 +8,7 @@ class Sidebar extends Class
|
||||||
@fixbutton_addx = 0
|
@fixbutton_addx = 0
|
||||||
@fixbutton_initx = 0
|
@fixbutton_initx = 0
|
||||||
@fixbutton_targetx = 0
|
@fixbutton_targetx = 0
|
||||||
|
@page_width = $(window).width()
|
||||||
@frame = $("#inner-iframe")
|
@frame = $("#inner-iframe")
|
||||||
@initFixbutton()
|
@initFixbutton()
|
||||||
@dragStarted = 0
|
@dragStarted = 0
|
||||||
|
@ -39,8 +40,18 @@ class Sidebar extends Class
|
||||||
@startDrag()
|
@startDrag()
|
||||||
@fixbutton.parent().on "click", (e) =>
|
@fixbutton.parent().on "click", (e) =>
|
||||||
@stopDrag()
|
@stopDrag()
|
||||||
@fixbutton_initx = @fixbutton.offset().left # Initial x position
|
@resized()
|
||||||
|
$(window).on "resize", @resized
|
||||||
|
|
||||||
|
resized: =>
|
||||||
|
@page_width = $(window).width()
|
||||||
|
@fixbutton_initx = @page_width - 75 # Initial x position
|
||||||
|
if @opened
|
||||||
|
@fixbutton.css
|
||||||
|
left: @fixbutton_initx - @width
|
||||||
|
else
|
||||||
|
@fixbutton.css
|
||||||
|
left: @fixbutton_initx
|
||||||
|
|
||||||
# Start dragging the fixbutton
|
# Start dragging the fixbutton
|
||||||
startDrag: ->
|
startDrag: ->
|
||||||
|
@ -88,6 +99,7 @@ class Sidebar extends Class
|
||||||
$(window).on "resize", =>
|
$(window).on "resize", =>
|
||||||
$(document.body).css "height", $(window).height()
|
$(document.body).css "height", $(window).height()
|
||||||
@scrollable()
|
@scrollable()
|
||||||
|
@resized()
|
||||||
$(window).trigger "resize"
|
$(window).trigger "resize"
|
||||||
|
|
||||||
# Override setsiteinfo to catch changes
|
# Override setsiteinfo to catch changes
|
||||||
|
@ -282,6 +294,7 @@ class Sidebar extends Class
|
||||||
|
|
||||||
onClosed: ->
|
onClosed: ->
|
||||||
$(window).off "resize"
|
$(window).off "resize"
|
||||||
|
$(window).on "resize", @resized
|
||||||
$(document.body).css("transition", "0.6s ease-in-out").removeClass("body-sidebar").on transitionEnd, (e) =>
|
$(document.body).css("transition", "0.6s ease-in-out").removeClass("body-sidebar").on transitionEnd, (e) =>
|
||||||
if e.target == document.body
|
if e.target == document.body
|
||||||
$(document.body).css("height", "auto").css("perspective", "").css("transition", "").off transitionEnd
|
$(document.body).css("height", "auto").css("perspective", "").css("transition", "").off transitionEnd
|
||||||
|
|
|
@ -171,6 +171,7 @@ window.initScrollable = function () {
|
||||||
this.loadGlobe = __bind(this.loadGlobe, this);
|
this.loadGlobe = __bind(this.loadGlobe, this);
|
||||||
this.animDrag = __bind(this.animDrag, this);
|
this.animDrag = __bind(this.animDrag, this);
|
||||||
this.waitMove = __bind(this.waitMove, this);
|
this.waitMove = __bind(this.waitMove, this);
|
||||||
|
this.resized = __bind(this.resized, this);
|
||||||
this.tag = null;
|
this.tag = null;
|
||||||
this.container = null;
|
this.container = null;
|
||||||
this.opened = false;
|
this.opened = false;
|
||||||
|
@ -179,6 +180,7 @@ window.initScrollable = function () {
|
||||||
this.fixbutton_addx = 0;
|
this.fixbutton_addx = 0;
|
||||||
this.fixbutton_initx = 0;
|
this.fixbutton_initx = 0;
|
||||||
this.fixbutton_targetx = 0;
|
this.fixbutton_targetx = 0;
|
||||||
|
this.page_width = $(window).width();
|
||||||
this.frame = $("#inner-iframe");
|
this.frame = $("#inner-iframe");
|
||||||
this.initFixbutton();
|
this.initFixbutton();
|
||||||
this.dragStarted = 0;
|
this.dragStarted = 0;
|
||||||
|
@ -210,7 +212,22 @@ window.initScrollable = function () {
|
||||||
return _this.stopDrag();
|
return _this.stopDrag();
|
||||||
};
|
};
|
||||||
})(this));
|
})(this));
|
||||||
return this.fixbutton_initx = this.fixbutton.offset().left;
|
this.resized();
|
||||||
|
return $(window).on("resize", this.resized);
|
||||||
|
};
|
||||||
|
|
||||||
|
Sidebar.prototype.resized = function() {
|
||||||
|
this.page_width = $(window).width();
|
||||||
|
this.fixbutton_initx = this.page_width - 75;
|
||||||
|
if (this.opened) {
|
||||||
|
return this.fixbutton.css({
|
||||||
|
left: this.fixbutton_initx - this.width
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return this.fixbutton.css({
|
||||||
|
left: this.fixbutton_initx
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Sidebar.prototype.startDrag = function() {
|
Sidebar.prototype.startDrag = function() {
|
||||||
|
@ -255,7 +272,8 @@ window.initScrollable = function () {
|
||||||
$(window).on("resize", (function(_this) {
|
$(window).on("resize", (function(_this) {
|
||||||
return function() {
|
return function() {
|
||||||
$(document.body).css("height", $(window).height());
|
$(document.body).css("height", $(window).height());
|
||||||
return _this.scrollable();
|
_this.scrollable();
|
||||||
|
return _this.resized();
|
||||||
};
|
};
|
||||||
})(this));
|
})(this));
|
||||||
$(window).trigger("resize");
|
$(window).trigger("resize");
|
||||||
|
@ -477,6 +495,7 @@ window.initScrollable = function () {
|
||||||
|
|
||||||
Sidebar.prototype.onClosed = function() {
|
Sidebar.prototype.onClosed = function() {
|
||||||
$(window).off("resize");
|
$(window).off("resize");
|
||||||
|
$(window).on("resize", this.resized);
|
||||||
$(document.body).css("transition", "0.6s ease-in-out").removeClass("body-sidebar").on(transitionEnd, (function(_this) {
|
$(document.body).css("transition", "0.6s ease-in-out").removeClass("body-sidebar").on(transitionEnd, (function(_this) {
|
||||||
return function(e) {
|
return function(e) {
|
||||||
if (e.target === document.body) {
|
if (e.target === document.body) {
|
||||||
|
@ -548,6 +567,7 @@ window.initScrollable = function () {
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ---- plugins/Sidebar/media/morphdom.js ---- */
|
/* ---- plugins/Sidebar/media/morphdom.js ---- */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ class Config(object):
|
||||||
|
|
||||||
def __init__(self, argv):
|
def __init__(self, argv):
|
||||||
self.version = "0.3.5"
|
self.version = "0.3.5"
|
||||||
self.rev = 838
|
self.rev = 839
|
||||||
self.argv = argv
|
self.argv = argv
|
||||||
self.action = None
|
self.action = None
|
||||||
self.createParser()
|
self.createParser()
|
||||||
|
|
Loading…
Reference in a new issue