Something like this should start.
EDIT
Here is a more complete example. Now the initial value is pulled from your url.
For instance. If the URL of your website is www.mysite.com/page2.html, you can add a URL (in this case, "startVal"), which can be accessed via JavaScript.
Thus, your URL will look like "www.mysite.com/page2.html?startVal=2", where startVal = 2 determines which element in the carousel is set as the selected starting element.
<script type="text/javascript">
var $sel = null;
$(document).ready(function () {
$.urlParam = function (name) {
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
if(results == null){
return 0;
}
return results[1] || 0;
}
var startVal = parseInt($.urlParam('startVal'));
$('#mycarousel').jcarousel({
start: startVal
});
$sel = $('#mycarousel li:nth-child(' + startVal + ')').find('img');
$sel.css('border', 'solid 2px blue');
$('#mycarousel img').click(function () {
$sel.css('border', 'solid 0px white');
$(this).css('border', 'solid 2px blue');
$sel = $(this);
});
});
</script>
EDIT
. , "startVal" null, .
, URL querystring, , .
:
- www.mysite.com/page1.html?startVal=1
- www.mysite.com/page2.html?startVal=2
- www.mysite.com/page3.html?startVal=3
- www.mysite.com/page4.html?startVal=4
, . , URL- 698 (www.mysite.com/page4.html?startVal=689), , .
, , , .