मैं गतिशील रूप से जेनरेट किए गए पेजर नेविगेशन के साथ JQuery चक्र का उपयोग कर रहा हूं। मैं छवि शीर्षक विशेषता से window.location.hash का उपयोग कर एक विशिष्ट स्लाइड से लिंक करने का तरीका जानने का प्रयास कर रहा हूं। मैंने इस उदाहरण का उपयोग करते हुए इस बिंदु तक प्लगइन को संशोधित करने का तरीका बताया (http://jquery.malsup.com/cycle/perma2.html#home), लेकिन यह लिंक नहीं करता है। यह आपको बस पहली स्लाइड पर भेजता है।छवि शीर्षक विशेषता से jQuery चक्र हैश यूआरएल
मैंने इस स्टैक ओवरफ्लो समर्थन थ्रेड (http://stackoverflow.com/questions/4969752/display-anchor-instead-of-index-in-url-with-jquery-cycle) का संदर्भ दिया, लेकिन वे मौजूदा का उपयोग कर रहे हैं पेजर नेविगेशन, फ्लाई पर जेनरेट नहीं किया गया है। मैं अभी भी Jquery सीखने के लिए नया हूँ, इसलिए किसी भी मार्गदर्शन की सराहना की है!
$(function() {
var h,
hash = window.location.hash,
hashes = {},
index = 0;
$('#slide img').each(function(i) {
h = $(this).find('img').attr('title');
hashes[h] = i;
});
if (hash)
index = hashes[hash.substring(1)] || index;
$('#slide').cycle({
fx: 'fade',
startingSlide: index, // <-- don't forget this!
speed: 'fast',
timeout: 0,
activePagerClass: 'active',
pager: '.timeline',
pagerAnchorBuilder: function(idx, slide) {
// return selector string for existing anchor
return '.timeline li:eq(' + idx + ') a';
},
after: function(curr,next,opts) {
h = $(this).find('img').attr('title');
window.location.hash = h;
}
});
});
धन्यवाद! यह इतना आसान फिक्स था! – hootnanny