Your IP : 216.73.216.147


Current Path : /home/lejardintz/www/media/foundry/3.1/scripts/
Upload File :
Current File : /home/lejardintz/www/media/foundry/3.1/scripts/responsive.min.js

FD31.plugin("responsive",function($){$.responsive=function(elem,options){return new Responsive(elem,options)},$.fn.responsive=function(conditions){if(conditions){var elem=this,options={elementWidth:function(elem){return elem.outerWidth(!0)},conditions:conditions};$.responsive(elem,options)}return this};var $window=$(window),$isFunc=$.isFunction,Responsive=function(elem,options){var self=this,elem=$(elem),instance=elem.data("$responsive");instance&&instance.destroy(),$.extend(self,{elem:elem,options:options,conditions:$.sortBy($.makeArray(options.conditions),function(condition){return condition.at
}),event:"resize.responsive"+$.uid(),handler:$.debounce(function(){self.set()},250)}),delete options.conditions,elem.data("$responsive",self),$(function(){$window.on(self.event,self.handler),self.set()}),$(window).load(function(){self.set()})};$.extend(Responsive.prototype,{set:function(){var self=this,elementWidth=self.options.elementWidth;self.elem.each(function(){var elem=$(this),currentWidth=$isFunc(elementWidth)?elementWidth(elem):elementWidth;self.removeCondition(elem.data("currentCondition"),elem),$.each(self.conditions,function(i,condition){var thresholdWidth=condition.at;
return thresholdWidth>=currentWidth?(self.applyCondition(condition,elem),!1):void 0})})},applyCondition:function(condition,elem){var switchTo,alsoSwitch,switchStylesheet,whenApplied;(switchTo=condition.switchTo)&&elem.addClass(switchTo),(alsoSwitch=condition.alsoSwitch)&&$.each(alsoSwitch,function(selector,classname){$(selector).addClass(classname)}),(switchStylesheet=condition.switchStylesheet)&&$.each($.makeArray(switchStylesheet),function(i,url){var stylesheet=$('link[href$="'+url+'"]');stylesheet.length<1&&$("<link/>").attr({rel:"stylesheet",type:"text/css",href:url}).appendTo("head")
}),(whenApplied=condition.whenApplied)&&$isFunc(whenApplied)&&whenApplied(),elem.data("currentCondition",condition).trigger("responsive",[condition])},removeCondition:function(condition,elem){if(condition){var switchTo,alsoSwitch,switchStylesheet,whenRemoved;(switchTo=condition.switchTo)&&elem.removeClass(switchTo),(alsoSwitch=condition.alsoSwitch)&&$.each(alsoSwitch,function(selector,classname){$(selector).removeClass(classname)}),(switchStylesheet=condition.switchStylesheet)&&$.each($.makeArray(switchStylesheet),function(i,url){$('link[href$="'+url+'"]').remove()
}),(whenRemoved=condition.whenRemoved)&&$isFunc(whenRemoved)&&whenRemoved(),elem.removeData("currentCondition")}},resetToDefault:function(current){var self=this,elem=self.elem;$.each(self.conditions,function(i,condition){current&&i==current||self.removeCondition(condition,elem)})},destroy:function(){$window.off(this.event);var self=this;self.elem.each(function(){var elem=$(this);self.removeCondition(elem.data("currentCondition"),elem)})}})});