MediaWiki

Jforeground.js

From Joomla! Documentation

Revision as of 13:34, 8 April 2015 by Tom Hutchison (talk | contribs) (drop 10px)

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
$('li#p-Learn a:first').prepend('<div class="drop-icon"><i class="fa fa-university fa-fw"></i></div>')
$('li#p-Help a:first').prepend('<div class="drop-icon"><i class="fa fa-life-ring fa-fw"></i></div>')
$('li#p-Browse a:first').prepend('<div class="drop-icon"><i class="fa fa-search fa-fw"></i></div>')

/* Smooth scroll of TOC links with correct offset */
jQuery(document).ready(function(){
    $('a[href^="#"]').on('click',function (e) {
        var headerHeight = 110;
        e.preventDefault();
 
        var hash = e.currentTarget.hash.substring(1);
        var anchorTag = $("span[id='" + hash + "']");
 
        $('html, body').stop().animate({
            'scrollTop': anchorTag.offset().top - headerHeight
        }, 1500, 'swing', function () {
            window.location.hash = target ;
        });
    });
});

/* Sticky navbars for mobile view */
jQuery(document).ready(function(){
	   $(window).bind('scroll', function() {
	   var navHeight = 68;
			 if ($(window).scrollTop() > navHeight) {
				 if ($('nav#topnav').hasClass('expanded')) {
	  				 $('nav#topnav').parent().addClass('fixed');
	  				 $('nav#topnav').removeClass('fixed');
	  				 $('nav#topnav').toggleClass('expanded').css('min-height', '');
	  				 $('body').css('padding-top','45px');
	  			 			 }
				 $('#bottom-nav').addClass('fixed');
				 $('#navwrapper').css('margin-bottom', '5em');
			 }
			 else {
				 $('#bottom-nav').removeClass('fixed');
				 $('body').css('padding-top','45px');
				 $('#navwrapper').css('margin-bottom', '1.875em');
			 }
		});
	});

/* Footer fix on small pages */

if ( mw.config.get( 'wgIsArticle' ) ) {
$(window).bind("load", function () {
    var footer = $("footer.row");
    var pos = footer.position();
    var height = $(window).height();
    height = height - pos.top;
    height = height - footer.height();
    if (height > 0) {
        footer.css({
            'position': 'fixed', 'bottom': '0', 'width': '100%'
        });
    }
});
}

/* AddThis script for social sharing do not remove */

mw.loader.load( 'https://s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5378f70766e02197&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400' );

var addthis_share = {
     url_transforms : {
          shorten: {
               twitter: 'bitly'
          }
     }, 
     shorteners : {
          bitly : {} 
     }
}