여기에 변수 'SRC'결과 전체 코드의를 정의되지 않은되고 - 왜 확실하지 않다.
<div class="photoslider" id="default"></div>
<script type="text/javascript">
$(document).ready(function(){
//change the 'baseURL' to reflect the host and or path to your images
FOTO.Slider.baseURL = '';
//set images by filling our bucket directly
FOTO.Slider.bucket = {
'default': {
<% if imgs1 <> "" then %> 0: {'thumb': '<%=replace(imgs1,"pn.","tn.")%>', 'main': '<%=imgs1%>'}<% end if %><% if imgs2 <> "" then %>,
1: {'thumb': '<%=replace(imgs2,"pn.","tn.")%>', 'main': '<%=imgs2%>'}<% end if %><% if imgs3 <> "" then %>,
2: {'thumb': '<%=replace(imgs3,"pn.","tn.")%>', 'main': '<%=imgs3%>'}<% end if %><% if imgs4 <> "" then %>,
3: {'thumb': '<%=replace(imgs4,"pn.","tn.")%>', 'main': '<%=imgs4%>'}<% end if %><% if imgs5 <> "" then %>,
4: {'thumb': '<%=replace(imgs5,"pn.","tn.")%>', 'main': '<%=imgs5%>'}<% end if %>
}
};
FOTO.Slider.reload('default');
FOTO.Slider.preloadImages('default');
FOTO.Slider.enableSlideshow('default');
//or set our images by the bucket importer
//var ids = new Array(0,1,2,3);
//FOTO.Slider.importBucketFromIds('default',ids);
console.log($('.photoslider_main img'));
var src = $(".photoslider_main img").attr("src");
$(".photoslider_main img").wrap($('<a/>').attr('href', 'waka').attr('class','lightbox'));
$('a.lightbox').lightBox();
// $('.photoslider_main img').live('click', function() {
// $(this).showLightbox();
// });
});
</script>
감사합니다. Greg! 나는 당신이 기꺼이 볼 수있는 경우에 이것으로 가지고있는 또 다른 문제점을 추가했습니다. –
내가 사용하는 이유를 모르겠다. var src = $ (". photoslider_main img"). attr ("src"); 경고를 결과 변수 "src", 계속 "정의되지 않은"점점? 나는 * photoslider가 구조를 설정 한 후에 이것을 호출 할 것이므로 반드시 작동해야합니다. –
document.ready() 내에서 작업하고 있습니까? 코드 흐름에 따라 (예 : photoslider를 호출 한 후) "후"인 경우 실제로 그 시점에서 완료되었음을 의미하지 않을 수 있습니다. 그 시점에서 이벤트 등을 기다리고있을 가능성이 있기 때문입니다. (javascript 및 jquery와 같은 라이브러리로 시작할 때 매우 일반적인 오류). console.log ($ ('. photoslider_main img'))를 실행하고 무엇을 얻을 수 있는지 확인하십시오. (방화 광명이 설치되어 있어야합니다.) – gregmac