Sha256: 45fe27a1699b913094e298e4f6e4166c3008e441273e4ad1e951df4cc1c14fd3
Contents?: true
Size: 935 Bytes
Versions: 1
Compression:
Stored size: 935 Bytes
Contents
// LOAD CUSTOM CSS // ----------------------------------- (function(window, document, $, undefined){ $(function(){ $('[data-load-css]').on('click', function (e) { var element = $(this); if(element.is('a')) e.preventDefault(); var uri = element.data('loadCss'), link; if(uri) { link = createLink(uri); if ( !link ) { $.error('Error creating stylesheet link element.'); } } else { $.error('No stylesheet location defined.'); } }); }); function createLink(uri) { var linkId = 'autoloaded-stylesheet', oldLink = $('#'+linkId).attr('id', linkId + '-old'); $('head').append($('<link/>').attr({ 'id': linkId, 'rel': 'stylesheet', 'href': uri })); if( oldLink.length ) { oldLink.remove(); } return $('#'+linkId); } })(window, document, window.jQuery);
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
radius-rails-3.1.4 | app/assets/javascripts/radius-theme/modules/load-css.js |