Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function () {
- //25.12.2018
- var minimized_elements = $('p.goods-text-desc');
- minimized_elements.each(function () {
- var t = $(this).text();
- if (t.length < 1300)
- return;
- $(this).html(
- t.slice(0, 1300) + '<span>... </span><a href="#" class="more">Читать далее</a>' +
- '<span style="display:none;">' + t.slice(1300, t.length) + ' <a href="#" class="less">Скрыть текст</a></span>'
- );
- });
- $('a.more', minimized_elements).click(function (event) {
- event.preventDefault();
- $(this).hide().prev().hide();
- $(this).next().show();
- });
- $('a.less', minimized_elements).click(function (event) {
- event.preventDefault();
- $(this).parent().hide().prev().show().prev().show();
- });
- /*25.12.2018 end */
- /*FOR INDEX PAGE 20.01.2019*/
- initSlider('.shop-item .single-item');
- initSlider('.shops-wrap_card .carusel-wrap .single-item');
- initSlider('.shops-wrap_card>.single-item');
- /*FOR SHOPS PAGE 20.01.2019*/
- $(" #number ").inputmask("+382-99-999-999");
- $('#id_of_page_container').pajinate();
- /*Скрыть PopUp при загрузке страницы*/
- PopUpHide();
- removeConfirmPopup();
- $("#btnShow").click(function (e) {
- e.preventDefault();
- $("#modal").show();
- $(".popup_overlay").show();
- setTimeout(removeConfirmPopup, 3000);
- });
- $('.image-upload-wrap').bind('dragover', function () {
- $('.image-upload-wrap').addClass('image-dropping');
- });
- $('.image-upload-wrap').bind('dragleave', function () {
- $('.image-upload-wrap').removeClass('image-dropping');
- });
- $("#search").focus(function () {
- $(".search-box").addClass("border-searching");
- $(".search-icon").addClass("si-rotate");
- });
- $("#search").blur(function () {
- $(".search-box").removeClass("border-searching");
- $(".search-icon").removeClass("si-rotate");
- });
- $("#search").keyup(function () {
- if ($(this).val().length > 0) {
- $(".go-icon").addClass("go-in");
- } else {
- $(".go-icon").removeClass("go-in");
- }
- });
- $(".go-icon").click(function () {
- $(".search-form").submit();
- });
- modalRatingRespond();
- var offset, i;
- if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
- offset = 3;
- } else {
- offset = 12;
- }
- $('#more-btn').on('click', function (e) {
- e.preventDefault();
- $.ajax({
- url: './data.html',
- type: 'POST',
- data: {
- offset: offset
- },
- success: function (data) {
- if (data) {
- for (i = 0; i < offset; i++) {
- $('#list-container').append(data);
- }
- $('.shop-item.uploaded').addClass("hidden").viewportChecker({
- classToAdd: 'visible animated fadeInLeft',
- offset: 100
- });
- initSlider('.single-item.ajax_added');
- $('#list-container').find('.ajax_added').removeClass('ajax_added');
- }
- }
- })
- });
- });
- function initSlider(name) {
- $(name).not('.slick-initialized').slick({
- dots: false,
- infinite: true,
- speed: 700,
- slidesToScroll: 1,
- arrows: true
- });
- }
- function readURL(input) {
- if (input.files && input.files[0]) {
- var reader = new FileReader();
- reader.onload = function (e) {
- $('.image-upload-wrap').hide();
- $('.file-upload-image').attr('src', e.target.result);
- $('.file-upload-content').show();
- $('.image-title').html(input.files[0].name);
- };
- reader.readAsDataURL(input.files[0]);
- } else {
- removeUpload();
- }
- }
- function removeUpload() {
- var cloned = $('.file-upload-input').clone();
- $('.file-upload-input').replaceWith(cloned);
- $('.file-upload-content').hide();
- $('.image-upload-wrap').show();
- }
- /*Функция отображения PopUp Main*/
- function PopUpShowMainPage() {
- $("#popup1").show();
- $(".popup_overlay").show();
- }
- /*Функция отображения PopUp Shop*/
- function PopUpShowShopPage() {
- $('#popup2').show();
- $(".popup_overlay").show();
- initSlider('#popup2>.main-goods-wrap>.single-item');
- initSlider('#popup2 .slide-goods-wrap>.single-item');
- }
- //Функция скрытия PopUp
- function PopUpHide() {
- $("#popup1").hide();
- $("#popup2").hide();/*25.12.2018*/
- $(".popup_overlay").hide();
- }
- function removeConfirmPopup() {
- $("#modal").hide();
- $(".popup_overlay").hide();
- }
- function modalRatingRespond() {
- var starWidth = 20; //width of one rating star in px
- var averageWidth;
- var userMark;
- $('.review_rating').mouseenter(function () {
- averageWidth = $(this).find('.current_rating').width();
- $(this).css('cursor', 'pointer');
- }).mousemove(function (evt) {
- userMark = Math.ceil((evt.pageX - $('.review_rating').offset().left) / starWidth);
- $(this).find('.current_rating').width(userMark * starWidth);
- }).click(function () {
- averageWidth = Math.round(userMark) * starWidth;
- //вот этот кусок записывает в скрытый инпут который с name = comment_mark
- $('input[name=comment_mark]').val(userMark);
- }).mouseleave(function () {
- $(this).find('.current_rating').width(averageWidth);
- });
- }
Add Comment
Please, Sign In to add comment