쥔안 비구이위안(균안 벽계원) 그랜드 호텔 | parentHeight){
$(this).siblings('.more_info').show();
}
});
}
}
var config = {
modules: {
'price-calendar': {
fullpath: 'templates/js/calendar.js',
type : 'js',
requires: ['price-calendar-css']
},
'price-calendar-css': {
fullpath: 'templates/css/calendar.css',
type : 'css'
}
}
};
YUI(config).use('price-calendar', 'jsonp', function(Y) {
var sub = Y.Lang.sub;
var url = 'travel_tee.php?act=calendar&tourism_id=87&callback={callback}';
// 价格日历实例
var oCal = new Y.PriceCalendar();
// 设置日历显示个数
oCal.set('count', 2).render();
// 时间范围限定
oCal.set('data', null)
.set('depDate', '') // 预订时间
.set('afterDays', ''); // 最小日期和最大日期的差值
oCal.set('minDate', $("#time").val()); // 最小日期
oCal.set('date', $("#time").val());
oCal.on('prevmonth', function(e) {
oCal.set('data', {});
Y.jsonp(sub(url, {mindate:this.get('minDate'), maxdate: this.get('maxDate')}),{
on:{
success: function(data) {
oCal.set('data', getDateObj(data.data));
}
}
});
});
oCal.on('nextmonth', function(e) {
oCal.set('data', {});
Y.jsonp(sub(url, {mindate:this.get('minDate'), maxdate:this.get('maxDate')}),{
on:{
success: function(data) {
oCal.set('data', getDateObj(data.data));
}
}
});
});
oCal.on('checkin', function(e) {
var depDate = this.get('depDate');
$('.next_step, .back_to_calendar').addClass('next_action');
get_price(depDate);
playD(depDate);
});
// 异步拉取数据
Y.jsonp(
sub(url, {
mindate: oCal.get('minDate'),
maxdate: oCal.get('maxDate')
}),
{
on: {
success: function(data) {
if(!data.succeed){
$('.price').text(PHONE_CONSOLATION);
$('#priceTagBefore').hide();
}
oCal.set('data', getDateObj(data.data));
}
}
}
);
/** 日历数据格式转换 */
function getDateObj(data){
var objOut = {};
for(var i = 0, len = data.length; i < len; i++) {
data[i]['share_price'] = parseInt(data[i]['share_price']); // 去掉价格小数点
objOut[data[i].travel_date] = data[i];
}
return objOut;
}
});
// 获取价格
function get_price(depDate) {
$.ajax({
url:"travel_tee.php?act=get_price_room",
data: {"tourism_id":'87', "travel_date": depDate, "travel_num": parseInt($('#num').text()),"type": "without_service"},
type: "post",
success:function(data){
var result = JSON.parse(data);
$('.total_cost').text(result.data.total_price);
}
});
}
/** 设置新日历样式 */
function playD(date){
var nPlayDate = $('input[name="date"]').val();
var tL = $('#calendar table');
for(var i=0;i 1) {
num--;
if(num == 1){
$('#num_dec').removeClass('num-dec-blue').addClass('num-dec-grey');
}
}
$(NUM).text(num);
var depDate = $('.dep-date').attr('data-date');
if (depDate != undefined) {
get_price(depDate);
}
});
$('#num_inc').click(function () {
var num = $(NUM).text();
if (num < 99) {
num++;
}
$('#num_dec').removeClass('num-dec-grey').addClass('num-dec-blue');
$(NUM).text(num);
var depDate = $('.dep-date').attr('data-date');
if (depDate != undefined) {
get_price(depDate);
}
});
$(".pic_focus").slide({
titCell: ".small_img li",
mainCell: ".big_img",
effect: "fold",
autoPlay: true,
delayTime: 200,
pnLoop: false,
trigger: "click",
interTime: 5000,
startFun:function(i, p){
//控制小图自动翻页
if(i==0){
$(".pic_focus .sPrev").click();
}else if( i > 0){
$(".pic_focus .sNext").click();
}
}
});
/*鼠标移过,左右按钮显示*/
$(".pic_focus .bigScroll").hover(function(){
$(this).parent(".pic_focus").find(".prev,.next").stop(true,true).fadeTo("show",1);
},function(){
$(this).parent(".pic_focus").find(".prev,.next").fadeOut();
});
$(".pic_focus .smallScroll").slide({
mainCell:"ul",
delayTime:100,
vis:4,
scroll: 1,
effect:"left",
autoPage:true,
prevCell:".sPrev",
nextCell:".sNext",
pnLoop:false
});
// endflash
/** 滚动定位页面 */
var navPos = 0;
$(document).scroll(function () {
var tourismNav = $(".tourism_detail_nav");
var tourismNavSpacer = $(".tourism_detail_nav_spacer");
var detailDaily = $('.detail_daily');
var guideList = $('.guide_list').children('li');
if (tourismNav.css('position') == 'relative') {
navPos = tourismNavSpacer.offset().top;
}
if ($(this).scrollTop() >= navPos) {
$('.tourism_detail_nav > a').show();
tourismNav.css('position', 'fixed');
tourismNavSpacer.height(tourismNav.outerHeight());
var scrollTop = $(document).scrollTop() + tourismNav.outerHeight();
$('.trip_detail').each(function (index) {
if ($(this).offset().top <= scrollTop) {
tourismNav.find('ul li').removeClass('current').eq(index).addClass('current');
}
});
detailDaily.each(function(index){
if($(this).offset().top <= scrollTop){
guideList.removeClass('active').eq(index).addClass('active');
}
});
if (tourismNav.find('ul li').first().hasClass('current')) {
$('.trip_detail_daily').each(function (index) {
if ($(this).offset().top <= scrollTop) {
tripDetailNav.find('li').removeClass('current').eq(index).addClass('current');
}
});
}
} else {
$('.tourism_detail_nav > a').hide();
tourismNav.css('position', 'relative');
tourismNavSpacer.height(0);
tourismNav.find('ul li').removeClass('current').first().addClass('current');
}
});
$('.tourism_detail_nav ul li').click(function () {
$(document).scrollTop($('.trip_detail').eq($(this).index()).offset().top - $('.tourism_detail_nav').outerHeight());
});
$('.guide_list').children('li').click(function(){
$(document).scrollTop($('.detail_daily').eq($(this).index()).offset().top - $('.tourism_detail_nav').outerHeight());
});
$('.trip_detail_side ul li').first().addClass('current');
// 日程标签跳转
$('.trip_detail_side ul li').click(function () {
/*var scrollPos = $('#' + $(this).attr('data-href')).offset().top - $('.tourism_detail_nav').outerHeight();
$('body, html').animate({scrollTop: scrollPos + 'px'});*/
$(document).scrollTop(
$('#' + $(this).attr('data-href')).offset().top - $('.tourism_detail_nav').outerHeight());
});
});
|