2012-05-07 5 views
0

Rails 3.1アプリでjQuery Lightboxを使用しています。アセットパイプラインを使用しているとき、JSファイルのイメージをどのように参照しますか?

// jQuery Lightbox Init/settings 
// Visit http://leandrovieira.com/projects/jquery/lightbox/ for more options and updates 
jQuery("a[href$=.jpg],a[href$=.png],a[href$=.gif]").lightBox({ 
    imageLoading: '/images/jquery-lightbox/lightbox-ico-loading.gif', // (string) Path and the name of the loading icon 
    imageBtnPrev: '/images/jquery-lightbox/lightbox-btn-prev.gif',  // (string) Path and the name of the prev button image 
    imageBtnNext: '/images/jquery-lightbox/lightbox-btn-next.gif',  // (string) Path and the name of the next button image 
    imageBtnClose: '/images/jquery-lightbox/lightbox-btn-close.gif', // (string) Path and the name of the close btn 
    imageBlank:  '/images/jquery-lightbox/lightbox-blank.gif'   // (string) Path and the name of a blank image (one pixel) 
}); 

答えて

0

これはjs.erbファイルである場合、あなたはルビーを使用することができます:私は.jsファイル内にある画像にこれらの参照を処理するための最良の方法です何を思ったんだけど、アセットパイプラインを使用していますそして、asset_path方法:

imageLoading: "<%= asset_path 'jquery-lightbox/lightbox-ico-loading.gif' %>" 

関連する問題