2012-03-08 11 views
3

Responsive OpenCart(1.5.2.1)テーマで作業しており、ColorBoxスクリプトを応答性の高いFancyBoxに置き換えました。 OpenCartスクリプトの。ColorBoxコールを使用したOpenCartスクリプトをResponsive FancyBoxコールに置き換える必要があります

私はColorBoxの部分を交換したいが、私はそれを仕事に使うことができる。

あなたが応答FancyBox here

<script type="text/javascript"><!-- 
$('#button-quote').live('click', function() { 
$.ajax({ 
    url: 'index.php?route=checkout/cart/quote', 
    type: 'post', 
    data: 'country_id=' + $('select[name=\'country_id\']').val() + '&zone_id=' + $('select[name=\'zone_id\']').val() + '&postcode=' + encodeURIComponent($('input[name=\'postcode\']').val()), 
    dataType: 'json',  
    beforeSend: function() { 
     $('#button-quote').attr('disabled', true); 
     $('#button-quote').after('<span class="wait">&nbsp;<img src="catalog/view/theme/sellegance/image/loading.gif" alt="" /></span>'); 
    }, 
    complete: function() { 
     $('#button-quote').attr('disabled', false); 
     $('.wait').remove(); 
    },  
    success: function(json) { 
     $('.success, .warning, .attention, .error').remove();   

     if (json['error']) { 
      if (json['error']['warning']) { 
       $('#notification').html('<div class="warning" style="display: none;">' + json['error']['warning'] + '<img src="catalog/view/theme/sellegance/image/close.png" alt="" class="close" /></div>'); 

       $('.warning').fadeIn('slow'); 

       $('html, body').animate({ scrollTop: 0 }, 'slow'); 
      } 

      if (json['error']['country']) { 
       $('select[name=\'country_id\']').after('<span class="error">' + json['error']['country'] + '</span>'); 
      } 

      if (json['error']['zone']) { 
       $('select[name=\'zone_id\']').after('<span class="error">' + json['error']['zone'] + '</span>'); 
      } 

      if (json['error']['postcode']) { 
       $('input[name=\'postcode\']').after('<span class="error">' + json['error']['postcode'] + '</span>'); 
      }     
     } 

     if (json['shipping_method']) { 
      html = '<h2><?php echo $text_shipping_method; ?></h2>'; 
      html += '<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data">'; 
      html += ' <table class="radio">'; 

      for (i in json['shipping_method']) { 
       html += '<tr>'; 
       html += ' <td colspan="3"><b>' + json['shipping_method'][i]['title'] + '</b></td>'; 
       html += '</tr>'; 

       if (!json['shipping_method'][i]['error']) { 
        for (j in json['shipping_method'][i]['quote']) { 
         html += '<tr class="highlight">'; 

         if (json['shipping_method'][i]['quote'][j]['code'] == '<?php echo $shipping_method; ?>') { 
          html += '<td><input type="radio" name="shipping_method" value="' + json['shipping_method'][i]['quote'][j]['code'] + '" id="' + json['shipping_method'][i]['quote'][j]['code'] + '" checked="checked" /></td>'; 
         } else { 
          html += '<td><input type="radio" name="shipping_method" value="' + json['shipping_method'][i]['quote'][j]['code'] + '" id="' + json['shipping_method'][i]['quote'][j]['code'] + '" /></td>'; 
         } 

         html += ' <td><label for="' + json['shipping_method'][i]['quote'][j]['code'] + '">' + json['shipping_method'][i]['quote'][j]['title'] + '</label></td>'; 
         html += ' <td style="text-align: right;"><label for="' + json['shipping_method'][i]['quote'][j]['code'] + '">' + json['shipping_method'][i]['quote'][j]['text'] + '</label></td>'; 
         html += '</tr>'; 
        }  
       } else { 
        html += '<tr>'; 
        html += ' <td colspan="3"><div class="error">' + json['shipping_method'][i]['error'] + '</div></td>'; 
        html += '</tr>';       
       } 
      } 

      html += ' </table>'; 
      html += ' <br />'; 
      html += ' <input type="hidden" name="next" value="shipping" />'; 
      html += ' <input type="submit" value="<?php echo $button_shipping; ?>" class="button" />';    
      html += '</form>'; 

      $.colorbox({ 
     overlayClose: true, 
     opacity: 0.5, 
     width: '600px', 
     height: '400px', 
     href: false, 
     html: html 
    }); 
     } 
    } 
}); 
を見つけることができます

}); // - >

私は

$(".fancybox").fancybox({ 
     maxWidth : 800, 
     maxHeight : 600, 
     fitToView : false, 
     width  : '70%', 
     height  : '70%', 
     autoSize : false, 
     closeClick : false, 
     openEffect : 'none', 
     closeEffect : 'none', 
     href: false, 
     html: html 
    }); 

$.colorbox({ 
     overlayClose: true, 
     opacity: 0.5, 
     width: '600px', 
     height: '400px', 
     href: false, 
     html: html 
    }); 

を交換しようとしましたが、そうでない場合は運

+1

なぜ、fancyboxがOC 1.5.Xから取り出されたのか理解できますか?これは、IEの負荷が非常に遅いためです。 –

+1

これは、以前にOpenCartで使用されていたものとは異なるfancyBoxスクリプトです。 – Edwin

+0

@JayGilford私は彼らがそれを削除したことを認識していないこれを解決するために年齢を試してきました。 – AlphaApp

答えて

1

でこれ

$.fancybox({ 
     maxWidth : 800, 
     maxHeight : 600, 
     fitToView : false, 
     width  : '70%', 
     height  : '70%', 
     autoSize : false, 
     closeClick : false, 
     openEffect : 'none', 
     closeEffect : 'none', 
     content  : html 
    }); 

をお試しくださいアサインg hrefの場合、そのオプションは必要ありません。さらにcontentは、とにかくhrefを上書きします。

+0

ありがとうJFKそれは今完璧に動作します! – Edwin

+0

これは正しいanswer.thanksとしてこれをチェックすることを忘れないでください – JFK

関連する問題