Funny side up – The New Indian Express

‘).addClass(‘flipbox-box’).css(‘transition-duration’,(this.options.animationDuration||0)+’ms’).css(‘transition-timing-function’,this.options.animationEasing).appendTo(this.$element);this.$front=$(”).addClass(‘flipbox-side flipbox-front’).appendTo(this.$box);this.$back=$(”).addClass(‘flipbox-side flipbox-back’).appendTo(this.$box);if(this.options.vertical){this.$box.addClass(‘flipbox-vertical’);this.$top=$(”).addClass(‘flipbox-side flipbox-top’).appendTo(this.$box);this.$bottom=$(”).addClass(‘flipbox-side flipbox-bottom’).appendTo(this.$box)}else{this.$box.addClass(‘flipbox-horizontal’);this.$left=$(”).addClass(‘flipbox-side flipbox-left’).appendTo(this.$box);this.$right=$(”).addClass(‘flipbox-side flipbox-right’).appendTo(this.$box)}this.$front.append(this.contents[this.contentIndex]);if(this.options.autoplay&&this.options.autoplayPauseOnHover){this.$element.on(‘mouseenter.’+namespace,function(){_this.toggleAutoplay(!1)}).on(‘mouseleave.’+namespace,function(){_this.toggleAutoplay(!0)})}this.resize();this.toggleAutoplay(this.options.autoplay);$(window).on(‘focus.’+namespace,function(){_this.toggleAutoplay(_this.options.autoplay)});$(window).on(‘blur.’+namespace,function(){_this.toggleAutoplay(!1)});this.trigger(‘created’)};FlipBox.prototype.update=function(){this.$box.css(‘transition-duration’,(this.options.animationDuration||0)+’ms’).css(‘transition-timing-function’,this.options.animationEasing);this.$element.off(‘mouseenter.’+namespace+’ mouseleave.’+namespace);if(this.options.autoplay&&this.options.autoplayPauseOnHover){var _this=this;this.$element.on(‘mouseenter.’+namespace,function(){_this.toggleAutoplay(!1)}).on(‘mouseleave.’+namespace,function(){_this.toggleAutoplay(!0)})}this.resize();this.toggleAutoplay(this.options.autoplay);this.trigger(‘updated’)};FlipBox.prototype.destroy=function(){$(window).off(‘focus.’+namespace+’ blur.’+namespace);this.$element.off(‘mouseenter.’+namespace+’ mouseleave.’+namespace);this.$element.removeClass(‘flipbox-wrapper’);this.$element.empty();this.$element.append(this.contents);this.trigger(‘destroyed’)};FlipBox.prototype.resize=function(){if(this.options.vertical){this.$box.css(‘transform-origin’,’0 ‘+(this.options.height/2)+’px -‘+(this.options.height/2)+’px’);this.$back.css(‘transform’,’translateZ(-‘+this.options.height+’px) rotateX(180deg)’);this.$top.css(‘transform’,’rotateX(-270deg) translateY(-‘+this.options.height+’px)’);this.$bottom.css(‘transform’,’rotateX(-90deg) translateY(‘+this.options.height+’px)’)}else{this.$box.css(‘transform-origin’,(this.options.width/2)+’px 0 -‘+(this.options.width/2)+’px’);this.$back.css(‘transform’,’translateZ(-‘+this.options.width+’px) rotateY(180deg)’);this.$left.css(‘transform’,’rotateY(270deg) translateX(-‘+this.options.width+’px)’);this.$right.css(‘transform’,’rotateY(-270deg) translateX(‘+this.options.width+’px)’)}};FlipBox.prototype.displayContent=function(contentIndex,reverse){if(this.contentIndex!==contentIndex){var $side=this.getNextSide(reverse);$side.find(‘>’).detach();$side.append(this.contents[contentIndex]);var prevIndex=this.contentIndex;this.contentIndex=contentIndex;this.flip(reverse,prevIndex,contentIndex)}};FlipBox.prototype.refreshCurrentContent=function(){var $side=this.getCurrentSide();$side.find(‘>’).detach();$side.append(this.contents[this.contentIndex])};FlipBox.prototype.addContent=function(newContent,contentIndex){contentIndex=contentIndex||contentIndex===0?contentIndex:this.contents.length;contentIndex=Math.min(Math.max(0,contentIndex),this.contents.length);this.contents.splice(contentIndex,0,$(newContent)[0]);this.contentIndex=Math.max(this.contentIndex,0);if(this.contentIndex===contentIndex){this.refreshCurrentContent()}this.trigger(‘added’,{index:contentIndex})};FlipBox.prototype.removeContent=function(contentIndex){contentIndex=Math.min(Math.max(0,contentIndex),this.contents.length);this.contents.splice(contentIndex,1);if(this.contentIndex===contentIndex){this.contentIndex=Math.min(this.contentIndex,this.contents.length-1);this.refreshCurrentContent()}this.trigger(‘removed’,{index:contentIndex})};FlipBox.prototype.replaceContent=function(newContent,contentIndex){contentIndex=contentIndex||contentIndex===0?contentIndex:this.contentIndex;contentIndex=Math.min(Math.max(0,contentIndex),this.contents.length);this.contents[contentIndex]=$(newContent)[0];if(this.contentIndex===contentIndex){this.refreshCurrentContent()}this.trigger(‘replaced’,{index:contentIndex})};FlipBox.prototype.flip=function(reverse,fromIndex,toIndex){var _this=this;this.trigger(‘flipping’,{reverse:reverse,currentIndex:fromIndex,nextIndex:toIndex});this.$box.off(‘transitionend.’+namespace).one(‘transitionend.’+namespace,function(){_this.trigger(‘flipped’,{reverse:reverse,prevIndex:fromIndex,currentIndex:toIndex})});if(this.options.vertical){this.rotation+=90*(reverse?-1:1);this.$box.css(‘transform’,’rotateX(‘+this.rotation+’deg)’)}else{this.rotation-=90*(reverse?-1:1);this.$box.css(‘transform’,’rotateY(‘+this.rotation+’deg)’)}};FlipBox.prototype.getCurrentSide=function(){var current=(this.rotation/90)%4;current=current0?this.contentIndex-1:this.contents.length-1,reverse)};FlipBox.prototype.jump=function(index,reverse){this.displayContent(Math.min(Math.max(index,0),this.contents.length-1),reverse)};FlipBox.prototype.trigger=function(name,data){this.$element.trigger(name,data)};$.fn.flipbox=function(options){var args=arguments;if(options===’size’){return $(this).data(namespace).contents.length}else if(options===’current’){return $(this).data(namespace).contentIndex}else{return this.each(function(){var $element=$(this);var flipbox=$element.data(namespace);if(options===’destroy’){flipbox.destroy();$element.data(namespace,null)}else if(options===’next’){flipbox.next(args[1])}else if(options===’prev’){flipbox.prev(args[1])}else if(options===’jump’){flipbox.jump(args[1],args[2])}else if(options===’add’){flipbox.addContent(args[1],args[2])}else if(options===’remove’){flipbox.removeContent(args[1])}else if(options===’replace’){flipbox.replaceContent(args[1],args[2])}else{if(!flipbox){flipbox=new FlipBox($element,options);$element.data(namespace,flipbox)}else{flipbox.config(options);flipbox.update()}}})}}})(jQuery); var wth = $(document).innerWidth()-120;var hth = $(window).height()-130; dragElement(document.getElementById(“cube”));function dragElement(elmnt){elmnt.onmousedown=dragMouseDown; function dragMouseDown(e){ e=e||window.event;e.preventDefault(); pos3=e.clientX;pos4=e.clientY; document.onmouseup=closeDragElement; document.onmousemove=elementDrag;}function elementDrag(e){ e=e||window.event; e.preventDefault(); pos1=pos3-e.clientX; pos2=pos4-e.clientY; pos3=e.clientX;pos4=e.clientY; var postion = $(‘#cube’).position(); if(postion.left >= 10 && postion.top >= 10 && postion.left wth){ elmnt.style.left = (wth -10)+”px”;}if(postion.top hth){ elmnt.style.top =(hth -10)+”px”;}}function closeDragElement(){document.onmouseup=null;document.onmousemove=null;}} $(document).ready(function(){ $(document).on(‘click’,”.side h6 span”,function(){ $(‘.box’).slideUp(700, function(){ $(‘.rmbxbtn’).remove(); $(‘body’).append(‘Show Stats‘); });$(document).on(‘click’ ,’.rmbxbtn’,function(){ $(‘.box’).slideDown(700, function(){ $(‘.rmbxbtn’).remove(); }); }); }); $.ajax({ type:’post’, url :’https://www.newindianexpress.com//user/commonwidget/corona?type=2′, cache:false, success:function(result){ $(‘#cube’).html(result); $(‘#cube’).flipbox({vertical: false,autoplay: true,autoplayReverse: false,autoplayWaitDuration: 3000,autoplayPauseOnHover: true}); } }); });

Leave a Comment