0
제품 이름과 제품 이미지 경로의 두 테이블을 사용하고 있습니다 ... 이미지 경로를 잡고 동적으로 이미지를 추가 할 수 있습니다. 그것은 잘 작동합니다.다른 테이블에서 값을 가져오고 jquery에 추가
문제는 그 이미지 위에 에 DIV 클래스는 호버에 이미지의 제목을 추가 할 때, 나는 jQuery의 각 기능을 사용하여 호버 DIV에 제목을 변경, 제목이 를 연결된보다는 추가됩니다 있다는 것입니다 특정 이미지로. 여기
테이블 경로에서 이미지를 추가하려면 코드 ..<script type="text/javascript">
$(document).ready(function() {
$('#mainContentPlaceholder_productPathGridView').hide(); //Hides ImagePath Gridview
var arr = []; //Creates an Array Path Arr
$("#mainContentPlaceholder_productPathGridView td").each(function() { //Loops through GridView Td (Table Columns)
arr.push($(this).text());
});
// Starts adding Images to the Gallery
$.each(arr, function (index, imageLocation) {
$(".megafolio-container").append('<div class="mega-entry jeans cat-all" data-src="' + imageLocation + '"' + 'data-width="395" data-height="507"><div class="mega-hover"><div class="mega-hovertitle"><h2 class="productNameTitle"></h2><a class="shopButton" href="itemDetails.aspx">Details</a></div></div></div>'); //Apended New Values
});
});
</script>
입니다 그리고 여기에 ID를 추가하는 내 추가 된 코드입니다
<!-- Getting Product Names-->
<script type="text/javascript">
$(document).ready(function() {
$('#mainContentPlaceholder_productNameGridView').hide(); //Hides ImagePath Gridview
var arr2 = []; //Creates an Array Path Arr
$("#mainContentPlaceholder_productNameGridView td").each(function() { //Loops through GridView Td (Table Columns)
arr2.push($(this).text());
});
// Starts adding Images to the Gallery
$.each(arr2, function (index, productname) {
// alert(productname);
$(".productNameTitle").text(productname); //Apended New Name
});
});
</script>
이제 문제는 IDS가 존재합니다 모든 div에 연결된 ...
가 working.i으로부터 다른 테이블과 이름 경로에서 이미지 경로를 원하지는 시도, HTML로 추가 이미지 경로는 잘 작동하지만, 이름 경로에 이름이 연결됩니다, 내가 사용하고 이미지 패스를 추가하는 경우와 같은 코드 div 인 productNameTitle에서 이름을 추가해야합니다. 추가하지만 모든 이름이 연결됩니다 .. 도와주세요. 덕분에 – designerNProgrammer
흠 ... 연결된 ... 내가 몇 가지 예를 보여줄 수 있습니까? ?? – bipen
괜찮 았어. .html() 메서드를 변경하려고했지만 11로 설정된 마지막 itemname 만 모든 div에 표시됩니다 ... 도와주세요. – designerNProgrammer