2017-04-10 7 views
0

Ich benutze Laravel 5.4 für dieses Projekt.Laravel Glyphicons

BUTTON CODE

<div class="modal-footer"> 
    <button type="button" class="btn btn-primary" data-dismiss="modal">I Agree</button> 
</div> 

JS-Code für Button es eine Checkbox

$(function() { 
$('.button-checkbox').each(function() { 

    // Settings 
    var $widget = $(this), 
     $button = $widget.find('button'), 
     $checkbox = $widget.find('input:checkbox'), 
     color = $button.data('color'), 
     settings = { 
      on: { 
       icon: 'glyphicon glyphicon-check' 
      }, 
      off: { 
       icon: 'glyphicon glyphicon-unchecked' 
      } 
     }; 

    // Event Handlers 
    $button.on('click', function() { 
     $checkbox.prop('checked', !$checkbox.is(':checked')); 
     $checkbox.triggerHandler('change'); 
     updateDisplay(); 
    }); 
    $checkbox.on('change', function() { 
     updateDisplay(); 
    }); 

    // Actions 
    function updateDisplay() { 
     var isChecked = $checkbox.is(':checked'); 

     // Set the button's state 
     $button.data('state', (isChecked) ? "on" : "off"); 

     // Set the button's icon 
     $button.find('.state-icon') 
      .removeClass() 
      .addClass('state-icon ' + settings[$button.data('state')].icon); 

     // Update the button's color 
     if (isChecked) { 
      $button 
       .removeClass('btn-default') 
       .addClass('btn-' + color + ' active'); 
     } 
     else { 
      $button 
       .removeClass('btn-' + color + ' active') 
       .addClass('btn-default'); 
     } 
    } 

    // Initialization 
    function init() { 

     updateDisplay(); 

     // Inject the icon if applicable 
     if ($button.find('.state-icon').length === 0) { 
      $button.prepend('<i class="state-icon ' + settings[$button.data('state')].icon + '"></i>'); 
     } 
    } 
    init(); 
    }); 
}); 

Ergebnis zu machen:

error Links of Glyph

Frage:

Wie kann ich diesen Link zu ändern, damit es meine Glyphicons findet Ordner mein Glyphicons Ordner kann bei

öffentlichen finden -> fonts -> Bootstrap -> (Glyphicons Dateien)

+1

Benutzer die Hilfsmethode 'public_path ('fonts/Bootstrap /'); 'oder' asset ('fonts/Bootstrap /'); ' – linktoahref

+0

' public_path' funktioniert gut ... –

Antwort

0

Ich weiß, die dumme Art und Weise ist zu tun Sie es, aber es funktioniert ..

Ändern des Bootstrap-Code ist sehr wichtig.

Was ich tat, war den Quellpfad der Glyphicons Innenseite meiner App.css

meine app.css zu ändern, ist das Stylesheet, das den Code des Bootstrap hält.

Dies ist der Teil, wo ich den Code bearbeitet habe.

@font-face { 
    font-family: Glyphicons Halflings; 
    src: url(../fonts/bootstrap/glyphicons-halflings-regular.eot?f4769f9bdb7466be65088239c12046d1); 
    src: url(../fonts/bootstrap/glyphicons-halflings-regular.eot?f4769f9bdb7466be65088239c12046d1) format("embedded-opentype"), url(../fonts/bootstrap/glyphicons-halflings-regular.woff2?448c34a56d699c29117adc64c43affeb) format("woff2"), url(../fonts/bootstrap/glyphicons-halflings-regular.woff?fa2772327f55d8198301fdb8bcfc8158) format("woff"), url(../fonts/bootstrap/glyphicons-halflings-regular.ttf?e18bbf611f2a2e43afc071aa2f4e1512) format("truetype"), url(../fonts/bootstrap/glyphicons-halflings-regular.svg?89889688147bd7575d6327160d64e760) format("svg") 
} 

, wie Sie die Quell-URL sind nicht mehr

src: url(.//fonts/glyphicons-halflings-regu...); 

sie sind bereits sehen ..

src: url(../fonts/bootstrap/glyphicons-halflings-regu...); 
+0

Was für mich funktioniert ist '@ font-face { Schriftfamilie: 'Glyphicons Halblings'; src: url ("../ fonts/bootstrap/glyphicons-halblings-regular.eot"); src: url ("../ Schriftarten/bootstrap/glyphicons-Halblings-regulary.eot? #iefix") Format ("eingebetteter-opentype"), URL ("../ fonts/bootstrap/glyphicons-halblings-regular. woff2 ") format (" woff2 "), url (" ../ fonts/bootstrap/glyphons-halblings-regular.woff ") format (" woff "), url (" ../ fonts/bootstrap/glyphicons-halblings- regular.ttf ") format (" truetype "), url (" ../ fonts/bootstrap/glyphons-halblings-regular.svg # glyphons_halflingsregular ") format (" svg "); } ' –