12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- /**
- * @version 7.9 [rev.7.9.01]
- */
- $(function () {
- $.fn.scrollToTop = function () {
- $(this).hide().removeAttr("href");
- if ($(window).scrollTop() != "0") {
- $(this).fadeIn("slow")
- }
- var scrollDiv = $(this);
- $(window).scroll(function () {
- if ($(window).scrollTop() == "0") {
- $(scrollDiv).fadeOut("slow")
- } else {
- $(scrollDiv).fadeIn("slow")
- }
- });
- $(this).click(function () {
- $("html, body").animate({
- scrollTop: 0
- }, "slow")
- })
- };
- $('#category-select-btn').click(function (e) {
- e.preventDefault();
- $('#category-select-content').slideToggle('1000');
- });
- $('#category-select-content').find('a').click(function (e) {
- e.preventDefault();
- var categoryName = $(this).attr('data-category-name');
- var categoryId = $(this).attr('data-id');
- var searchForm = $(this).closest('form');
- searchForm.find('input[name="parent_id"]').val(categoryId);
- $('#category-select-btn').find('span').text(categoryName);
- $('#category-select-content').hide('1000');
- });
- // mobile search box hide / show on scroll
- var senseSpeed = 5;
- var previousScroll = 0;
- $(window).scroll(function (e) {
- var scroller = $(this).scrollTop();
- if ((scroller - senseSpeed) > previousScroll) {
- // downscroll code
- $('#mobile-navigation').find('.mobile-search').slideUp(200, 'linear');
- } else if ((scroller + senseSpeed) < previousScroll) {
- // upscroll code
- $('#mobile-navigation').find('.mobile-search').slideDown(200, 'linear');
- }
- previousScroll = scroller;
- });
- $('#browse-btn').click(function (e) {
- e.preventDefault();
- $('#browse-content').toggle('1000');
- $(this).toggleClass('active');
- if ($(this).hasClass('active')) {
- $(this).find('i').attr('class', 'fa fa-angle-up');
- }
- else {
- $(this).find('i').attr('class', 'fa fa-angle-down');
- }
- });
- $(".scroll-top").scrollToTop();
- });
|