좋아요, 코드를 직접 게시하면 안되지만 문제가 어디에 있는지 잘 모르겠습니다.jQuery가 IE 7 및 Chrome에서 작동하지 않습니다.
해당 페이지는 letterlyyours.com/design.php에 있습니다. 그것이 작동해야하는 방법은 단어를 입력하고 "제출"을 누르면 아래에 각 글자의 작은 사진이 나타나며 위아래로 스크롤 할 수 있습니다. 또한 미리보기 이미지를 클릭하면 fancybox가 열리고 전체 이미지가 표시됩니다.
크롬에서는 모든 스크롤 화살표가 비활성화되어 있습니다. 또한 IE 6/7 (IE 8에서 작동)에서 fancybox는 목록의 첫 번째 축소판에 대해서만 작동합니다. 이상하지 않니?
어쨌든 다른 문제를 해결하기 위해 해킹해야 할 문제가있을 수 있습니다. 사진 목록을보기 위해 필자는 원래 사진과 같은 2D 배열을 사용했지만 파이어 폭스에서만 작동하므로 eval ('photos'+ number + '[index])과 같이 변경했습니다. 앞에서 말한 문제를 제외하고는 IE에서 작동하는 것처럼 보였다.
모든 자바 스크립트 코드를 사용하여 파일에 대한 링크입니다 : http://letterlyyours.com/jcarousel/design.js.php
여기에 코드입니다 :
photos0 = [
{url: "photos/thumb_A 1.jpg", title: "A 1"},
{url: "photos/thumb_A 2.jpg", title: "A 2"},
...
];
...
...
photos25 = [
{url: "photos/thumb_Z 1.jpg", title: "Z 1"},
...
];
jQuery(document).ready(function() {
jQuery('#create').submit(function(event) {
var word = jQuery('#word').val();
event.preventDefault();
jQuery('ul').unbind();
jQuery("#creation").html('');
jQuery('#creation').css('width', Math.max(122, 75*word.length));
for (var a = 0; a < word.length; a++)
{
jQuery('#creation').append('<ul class="jcarousel jcarousel-skin-tango" id="carousel' + a + '"></ul>');
var total = eval('photos' + parseInt(word.toUpperCase().charCodeAt(a)-65) + '.length');
for (var b = 0; b < total; b++)
{
var url = eval('photos' + parseInt(word.toUpperCase().charCodeAt(a)-65) + '[b].url');
var url_full = url.replace('thumb_', '');
jQuery('#carousel' + a).append('<li><a id="thumb' + b + '" href="' + url_full + '"><div style="width: 75px; height: 113px; background-image: url(\'' + url + '\');"></div></a></li>');
jQuery('a#thumb' + b).fancybox({
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'hideOnContentClick': true
});
}
jQuery('#carousel' + a).jcarousel({
vertical: true,
scroll: 1,
itemVisibleInCallback: function(carousel, li, index, state) {
jQuery(li).parent().data('image', jQuery(li).children('a').children('div').css('background-image').replace(/"/g, ''));
}
});
}
jQuery('#creation').append('<a id="order" href="#orderform"><img width="122" height="24" src="images/button_order.png" tabindex="3" alt="Order Yours" /></a>');
jQuery('a#order').fancybox({
'hideOnContentClick': false,
'transitionIn': 'fade',
'frameWidth': 'auto',
'title': 'Order \'' + word + '\'',
'overlayShow': true,
'overlayOpacity': 0.8,
'overlayColor': 'black',
'onStart': function() {
jQuery('#list').html('');
jQuery('#cost').html(word.length + ' photos at $6.00 per photo <br />Total: $' + word.length*6);
jQuery('form#contact-form').unbind();
jQuery('form#contact-form').submit(function(event) {
jQuery.fancybox.showActivity();
jQuery.post('contact.php', jQuery('form#contact-form').serialize(), function()
{
jQuery.fancybox(jQuery('div#thanks'));
});
event.preventDefault();
});
var photolist = '';
for (a = 0; a < word.length; a++)
{
jQuery('#list').append('<div style="float: left; width: 75px; height: 113px; background-image: ' + jQuery('#carousel' + a).data('image') + '"/>');
photolist += jQuery('#carousel' + a).data('image');
}
jQuery('#photonames').val(photolist);
}
});
});
jQuery('#word').keypress(function(event) {
var letter = event.which;
if ((letter != 8) && (letter != 0))
{
if (letter < 97)
letter += 32;
if (!((letter >= 97) && (letter <= 122)))
{
event.preventDefault();
}
}
});
jQuery('#word').select(function(event) {
event.preventDefault();
});
});
당신이 게시 한 링크는 읽기가 조금 어렵습니다. 질문에 관련 코드를 게시 할 수 있습니까? – czarchaic
어떤 이유로 http://letterlyyours.com/jcarousel/design.js.php의 파일이 Microsoft Security Essentials에서 바이러스로 탐지되고 있습니다. 나는 그것이 거짓 긍정이지만 귀하의 사용자가 그것을보고 있다면 좋지 않다고 생각합니다. –
@Sam 확장자가 .js.php 일 수 있습니다. –