/** * PremiumMediaScript jQuery Custom Functions - Don't edit anything below! * Copyright @KBRmedia - All rights Reserved */ (function($){ // Sticky $.fn.extend({ sticky: function(a) { var b = { TopMargin: 0, Container: '.sidebar' } var e = $(this); if(!e.length) return false; var s = $.extend(b, a); var w = e.width(); var h = e.height(); var pos = $(s.Container).offset(); $(window).scroll(function(){ if(window.pageYOffset >= (pos.top + $(s.Container).height())){ e.css({ position: 'fixed', top: s.TopMargin, left: pos.left + 10, margin: 0, width: w, height: h }); }else{ e.attr('style',''); } }); } }); // Tooltip $.fn.extend({ tooltip: function(a){ $(this).hover(function(){ var d=$(this).attr("data-content"); var pos=$(this).offset(); var x=pos.left + $(this).width() + 10; var y=pos.top + 2; $("body").append(""+d+""); },function(){ $("#tooltip").remove(); }); } }); // Smooth Scroll $.fn.extend({ smoothscroll: function(settings) { var defaults = { holder: 0 }; var s = $.extend(defaults, settings); $(this).click(function(e){ e.preventDefault(); if(!s.holder){ var href=$(this).attr("href"); }else{ var href=s.holder; } var pos=$(href).position(); var css=$(this).attr('class'); $("."+css).removeClass("active"); $('body,html').animate({ scrollTop: pos.top-30 }); }); } }); // Modal $.fn.extend({ modal: function(settings) { var defaults = { title:$(this).attr("title"), content:$(this).attr("data-content"), link:$(this).attr("href"), close: 0 }; var s = $.extend(defaults, settings); $.fn.modal_destroy=function(){ $("#modal-shadow").fadeOut('normal',function(){ $(this).remove(); }); $("#modal-alert").fadeOut('normal',function(){ $(this).remove(); }); return; } if(s.close){ $(document).modal_destroy(); return; } if(!s.content){ s.content="Note that this action is permanent. Once you click proceed, you may not undo this. Click anywhere outside this modal or click close to close this."; } if(!s.title){ s.title="Are you sure you want to proceed?"; } if(s.link == ""){ var proceed=""; }else{ var proceed="Proceed Cancel"; } if($("#modal-alert").length>0) $(document).modal_destroy(); $("body").prepend('
'); $("#modal-shadow").css("height",$(document).height()).hide(); $("#modal-shadow").show(); var left = ($(window).width() - $("#modal-alert").width())*0.5; var top = 20; $("#modal-alert").css({"top":top,"left":left}).hide(); $("#modal-alert").fadeIn(); $("#modal-alert").html("