快速註冊會員登入VeryBuy 粉絲專頁關於我們會員條款隱私權政策APP下載廠商合作申請人才招募聯絡我們常見問題.
0
0
(function($)
//setting mobile search hidden
window.isSearchformHidden = 0;
var $form = $('#showform');
$form.show();//default style
window.headerMobileHeight = $('#header_MQ').innerHeight() - $('#showform').innerHeight();
window.headerShowformHeight = $('#showform').innerHeight() + headerMobileHeight;
/* panel slider func :: for RWD */
$(document).ready(function()
if (verybuy.isResponsive())
$('#show_slidepanel').slidepanel(
orientation: 'left',
mode: 'push'
);
);
$(':input[name=country_code]').change(function()
verybuy.changeCountry($(this).val());
);
$('a.a_select_country').click(function(e)
e.preventDefault();
verybuy.changeCountry($(this).data('country-code'));
);
//form controller
$('#searchMobile').on('click', function()
if (window.isSearchformHidden == 1)
$form.show();
$('#header_MQ').css('height', window.headerShowformHeight);
window.isSearchformHidden = 0;
else
$form.hide();
$('#header_MQ').css('height', window.headerMobileHeight);
window.isSearchformHidden = 1;
);
$('input[name=search_keyword]').change(function()
$('input[name=search_keyword]').val($(this).val());
);
$('body').on('click', '.search_button:visible', function()
var $form = $(this).parents('form');
var search_keyword = $form.find('input[name=search_keyword]').val();
if ('' == search_keyword.trim())
alert('請輸入搜尋的商品名稱!!!');
return false;
verybuy.actions.search(search_keyword)
$form.submit();
);
$('body').on('click', 'a.nav_logout', function(e)
verybuy.logout();
e.preventDefault();
);
$('.account_menu').click(function(e)
e.preventDefault();
if ($('ul.accountHover:visible').size() > 0)
document.location.href = '/member';
var $ul = $('ul.accountHover:hidden');
setTimeout(function()
if ($ul.is(':hidden'))
$ul.show();
$('.js-mailBox').addClass('u-hidden')
else
$ul.hide();
, 100);
);
$(document).click(function(e)
$ul = $('ul.accountHover');
if (!$ul.is(e.target) && $ul.has(e.target).length === 0)
$('.js-mailBox').removeClass('u-hidden')
$ul.hide();
);
$('ul[class=nav] li').hover(function()
$(this).children('ul').show();
, function()
$(this).children('ul').hide();
);
//下方次選單
$('ul[class="nav"] li ul li').click(function()
$(this).parent().find('a.actived').removeClass('actived');
$(this).children('a').addClass('actived');
);
/* 關閉購物車預覽 */
var hide_preview_cart = function()
$('.preCart:visible').removeClass('showing').hide().siblings('[class*=cart]').removeClass('mouseover');
;
/* 購物車預覽 */
$('.navBar').delegate('.cart_amount', 'mouseenter', function()
var $cart = $(this).parent();
$cart.addClass('mouseover').siblings('.preCart').show('fast', function()
if ($cart.is('.cart2'))
$(this).addClass('simple');
);
).delegate('.cart_amount', 'mouseleave', function()
setTimeout(function()
if (!$('.preCart:visible').is('.showing'))
hide_preview_cart();
, 100);
);
$('.preCart').mouseenter(function()
$(this).addClass('showing');
).mouseleave(function()
hide_preview_cart();
);
/* 關閉Banner */
$('.close_banner').click(function()
$(this).parent('li').hide();
);
)(jQuery);
回頂端
var uvOptions = ;
(function()
var uv = document.createElement('script'); uv.type = 'text/javascript'; uv.async = true;
uv.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'widget.uservoice.com/Efes3rtqUSHYoaO185U4A.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(uv, s);
)();
$(document).ready(function()
verybuy.is_computer = ('computer' == verybuy.device_type);
var clientWidth = document.body.clientWidth
var timer
$(window).resize(function ()
clearTimeout(timer);
timer = setTimeout(function()
clientWidth = document.body.clientWidth
, 800)
);
//網頁版 + 手機版 => Action: 往下滑之後,就收起搜尋框, 回到頂端後,再度顯示搜尋框
var headerShowformSpy = function(targetPoint)
var $form = $('#showform');
var scroll_top = $(window).scrollTop();
if (scroll_top >= targetPoint)
$form.hide();
$('#header_MQ').css('height', window.headerMobileHeight);
window.isSearchformHidden = 1;
else
$form.show();
$('#header_MQ').css('height', window.headerShowformHeight);
window.isSearchformHidden = 0;
;
//網頁版
var sticky_navigation = function()
if (verybuy.isResponsive())
return;
var scroll_top = $(window).scrollTop();
if (scroll_top >= 80)
if (!$('#header_fixed').hasClass('showing'))
$('#header_fixed').addClass('showing');
$('#header_org').removeClass('showing');
$('#member_cart').hide();
$('#member_cart_fixed').show();
$('#header_org .accountHover').addClass('u-hidden')
else
if (!$('#header_org').hasClass('showing'))
$('#header_fixed').removeClass('showing');
$('#header_org').addClass('showing');
$('#member_cart_fixed').hide();
$('#member_cart').show();
$('#header_org .accountHover').removeClass('u-hidden')
;
sticky_navigation();
$(window).scroll(function()
if (clientWidth > 768)
//網頁版
sticky_navigation();
var targetPoint = window.isSearchformHidden ? (140 - window.headerShowformHeight) : 140;
else
// 手機版
var bannerHeight = $('#header_MQ').hasClass('trim-smartBanner') ? $('#header_MQ .smartBanner').innerHeight() : 0;
var headerWithBannerHeight = 140 + bannerHeight;
var targetPoint = window.isSearchformHidden ? (headerWithBannerHeight - window.headerShowformHeight) : headerWithBannerHeight;
$('#member_cart_fixed').hide();
headerShowformSpy(targetPoint);
);
);
// $('.tagsCloud > a').click(function(e)
// var eventParameters =
// 'event_category': 'keyword tag',
// 'event_label': $(this).text()
// ;
// verybuy.gaSendEvent('click', eventParameters);
// );
客服
var callback_FB_init = function()
;
verybuy.FB_init(callback_FB_init);
// Load the SDK Asynchronously
(function(d, s, id)
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/zh_TW/sdk.js#xfbml=1&version=v2.5";
fjs.parentNode.insertBefore(js, fjs);
(document, 'script', 'facebook-jssdk'));
var _paq = _paq || [];
/* tracker methods like “setCustomDimension” should be called before “trackPageView” */
var MID = '0';
if (MID != '0')
_paq.push(['setUserId', MID]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
// (function()
// var u="//b.verybuy.tw/";
// _paq.push(['setTrackerUrl', u+'piwik.php']);
// _paq.push(['setSiteId', '2']);
// var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
// g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
// )();
<!--
(function($)
$('img.lazy').lazyload(
threshold: 500
);
$('ul.productList').delegate('a.like', 'click', function(e)
verybuy.actions.funnelChange(3)
if (!verybuy.MID)
if (confirm('請先登入會員才能收藏喔!'))
document.location.href = '/member/login';
return;
var $this = $(this);
var PID = $this.data('pid');
var id = $this.data('id');
$.ajax(
'type': 'POST',
'url': '/tuango/ajax_love_item/',
'data': 'PID': PID, 'id': id, "verybuy_csrf_token": "80523c469ce3a7084cb964dbdb928fc0",
'dataType': 'json',
'beforeSend': function()
$this.html('');
,
'success': function(result)
/* 回傳 收藏的數量*/
$this.html(result.count);
if (result.error)
alert(result.message);
return;
, 'json');
e.preventDefault() ;
);
$(function()
verybuy.countDown.init('.countdown');
);
)(jQuery);
//-->