Using Jquery in DataList
-
Hey guys, I'm new to Jquery and I'm trying to use
jCapSlide
in a datalist,
'<%# Eval("Category.cName")%>'
'<%# Eval("pTitle") %>' '<%# Eval("pTitle") %>'
with this Function
<script type="text/javascript">
$(function () {
$("#capslide_img_cont").capslide({
caption_color: 'white',
caption_bgcolor: 'black',
overlay_bgcolor: 'black',
border: '',
showcaption: false
});
});
</script>There are 3 records, this applies on the first one but not the other two, I think the problem is repeated
id="capslide_img_cont"
but can't seem to fix it. can you help me out ? It's deeply appreciated
-
Hey guys, I'm new to Jquery and I'm trying to use
jCapSlide
in a datalist,
'<%# Eval("Category.cName")%>'
'<%# Eval("pTitle") %>' '<%# Eval("pTitle") %>'
with this Function
<script type="text/javascript">
$(function () {
$("#capslide_img_cont").capslide({
caption_color: 'white',
caption_bgcolor: 'black',
overlay_bgcolor: 'black',
border: '',
showcaption: false
});
});
</script>There are 3 records, this applies on the first one but not the other two, I think the problem is repeated
id="capslide_img_cont"
but can't seem to fix it. can you help me out ? It's deeply appreciated
try
$('[id*="capslide_img_cont"]')
it's a wildcard that accepts any prefix, and the suffix you enter. asp.net will inject a prefix like $content100 in front of your id name. so it becomes something like $content100_capside_img_cont As far as the 2nd and 3rd record goes, I'm not sure yet, not enough info
-
Hey guys, I'm new to Jquery and I'm trying to use
jCapSlide
in a datalist,
'<%# Eval("Category.cName")%>'
'<%# Eval("pTitle") %>' '<%# Eval("pTitle") %>'
with this Function
<script type="text/javascript">
$(function () {
$("#capslide_img_cont").capslide({
caption_color: 'white',
caption_bgcolor: 'black',
overlay_bgcolor: 'black',
border: '',
showcaption: false
});
});
</script>There are 3 records, this applies on the first one but not the other two, I think the problem is repeated
id="capslide_img_cont"
but can't seem to fix it. can you help me out ? It's deeply appreciated
$("#capslide_img_cont") will get the first element.if you use 'Id' attribute,there will be not only one div with 'id' attribute.it's not good.so I suggest using 'name' attribute ,and then $("div[name='capslide_img_cont']").capslide.or using 'class' attribute if no one use 'ic_container' except this div.zhe code below:
$(function () { $(".capslide\_img\_cont").capslide({ caption\_color: 'white', caption\_bgcolor: 'black', overlay\_bgcolor: 'black', border: '', showcaption: false }); }); </script></pre></x-turndown>