Blame view

book/renkei-book/js/noty/layouts/centerRight.js 1.25 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
;(function($) {

	$.noty.layouts.centerRight = {
		name: 'centerRight',
		options: { // overrides options

		},
		container: {
			object: '<ul id="noty_centerRight_layout_container" />',
			selector: 'ul#noty_centerRight_layout_container',
			style: function() {
				$(this).css({
					right: 20,
					position: 'fixed',
					width: '310px',
					height: 'auto',
					margin: 0,
					padding: 0,
					listStyleType: 'none',
					zIndex: 10000000
				});

				// getting hidden height
				var dupe = $(this).clone().css({visibility:"hidden", display:"block", position:"absolute", top: 0, left: 0}).attr('id', 'dupe');
				$("body").append(dupe);
				dupe.find('.i-am-closing-now').remove();
				dupe.find('li').css('display', 'block');
				var actual_height = dupe.height();
				dupe.remove();

				if ($(this).hasClass('i-am-new')) {
					$(this).css({
						top: ($(window).height() - actual_height) / 2 + 'px'
					});
				} else {
					$(this).animate({
						top: ($(window).height() - actual_height) / 2 + 'px'
					}, 500);
				}

				if (window.innerWidth < 600) {
					$(this).css({
						right: 5
					});
				}

			}
		},
		parent: {
			object: '<li />',
			selector: 'li',
			css: {}
		},
		css: {
			display: 'none',
			width: '310px'
		},
		addClass: ''
	};

})(jQuery);