/*! * jQuery scrollToTop_fss * Version 1.0.11 * * Requires: * - jQuery 1.7 or higher * * https://fullstackcolombia.tk * * Copyright 2016, Miguel Angel Leon * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ (function ($,window, document, undefined) { $.fn.extend({ scrollToTop_fss: function (options) { var defaults = { targetId: 'btn_back_top_fss', targetClass: '', targetTitle: 'Back top', targetUrl: 'https://fullstackcolombia.tk/lib/plugins/scrolltop/top1.png', mode: 'vertical', container: window, opacity: 0.7, distanceScrollTop: 100, bottom: 25, right: 25, dimensionWidthHeight: 28, borderRadius: '50%', delayTime: 1000 }; var settings = $.extend({}, defaults, options); var o = settings; var b = o.container == window?'body':o.container; $(b).append('
'); if(o.container == window){ $('#'+o.targetId).css("position","fixed").css("bottom",o.bottom+"px").css("right",o.right+"px").css("opacity",o.opacity).css("z-index",5000000); } else { //posXc = $(o.container).offset().top + $(o.container).outerHeight() - o.bottom - 15; //posYc = $(o.container).offset().left + $(o.container).outerWidth() - o.right - 30; //console.log(posXc); //console.log(posYc); //.css("top",posXc+"px").css("left",posYc+"px") $('#'+o.targetId).css("position","absolute").css("bottom",o.bottom+"px").css("right",o.right+"px").css("opacity",o.opacity).css("z-index",5000000); } $('#'+o.targetId+' span').css("width",o.dimensionWidthHeight+"px").css("height",o.dimensionWidthHeight+"px").css("display","block").css("background","url("+o.targetUrl+") no-repeat center center").css('border-radius',o.borderRadius); $(o.container).on('scroll',function(){ $(o.container).scrollTop() > o.distanceScrollTop?$('#'+o.targetId).fadeIn():$('#'+o.targetId).fadeOut(); }); $(o.container).scrollTop() > o.distanceScrollTop?$('#'+o.targetId).fadeIn():$('#'+o.targetId).fadeOut(); $('#'+o.targetId+' a').on('click',function(event) { event.preventDefault(); var bn = (b == 'body')?'body,html':o.container; $(bn).animate({ scrollTop: 0 }, o.delayTime); return true; }); }}); })(jQuery,window,document,undefined)