简体   繁体   English

幻灯片停止工作,控制台显示没有相关错误? 但是这一无关

[英]Slideshow stopped working console shows no related errors? But this one unrelated

Here is the error that shows "TypeError: undefined is not an object (evaluating 'tjq("#price-range").data('url-noprice').replace')" 这是显示"TypeError: undefined is not an object (evaluating 'tjq("#price-range").data('url-noprice').replace')"

That has nothing to do with the slideshow that I can think of? 这与我能想到的幻灯片无关吗? If you look at the page source you can see the images are there, but the photos tab at the top no longer expands and shows the slide images. 如果您查看页面源,则可以看到其中的图像,但是顶部的“照片”选项卡不再展开并显示幻灯片图像。

Example bag: 示例袋:

http://www.foreversummer.net/accommodation/villas-pappagallo-3/?adults=1&kids=0&rooms=1&date_from&date_to&child_ages%5B0%5D=0 http://www.foreversummer.net/accommodation/villas-pappagallo-3/?adults=1&kids=0&rooms=1&date_from&date_to&child_ages%5B0%5D=0

Here is the part of the script that it is having an issue with. 这是脚本遇到问题的部分。

if (tjq(".filters-container").length > 0) {
    // price range
    var price_slide_min_val = 0;
    var price_slide_step = tjq("#price-range").data('slide-step');
    var price_slide_last_val = tjq("#price-range").data('slide-last-val');
    var price_slide_max_val = price_slide_last_val + price_slide_step;

    var def_currency = tjq("#price-range").data('def-currency');
    var min_price = tjq("#price-range").data('min-price');
    var max_price = tjq("#price-range").data('max-price');
    if (max_price == "no_max") { max_price = price_slide_max_val; }
    var url_noprice = tjq("#price-range").data('url-noprice').replace(/&/g, '&');
    if ((min_price != 0) || (max_price != price_slide_max_val)) {
        tjq('#price-filter').collapse('show');
        tjq('a[href="#price-filter"]').removeClass('collapsed');
    }

Any help would be appreciated, if you spot something I have missed. 如果您发现我错过的任何东西,任何帮助将不胜感激。 This one has me stumped. 这个让我难过。 Could this issue be causing the rest of the query to malfunction? 这个问题可能导致其余查询出现故障吗?

I've looked into the URL you added and saw the aforementioned js code. 我查看了您添加的URL,并看到了前面提到的js代码。

It seems that you're looking for a dom element with the id "price-range", but it does not exist in your document dom. 似乎您正在寻找ID为“ price-range”的dom元素,但是它在文档dom中不存在。 The element itself is missing. 元素本身丢失。

The following line: 下一行:

var url_noprice = tjq("#price-range").data('url-noprice').replace(/&/g, '&');

raises an error because the script is trying to use the method "replace" on an undefined object. 引发错误,因为脚本试图在未定义的对象上使用方法“替换”。 Step by step: 一步步:

  1. tjq("#price-range") → returns an empty array of objects tjq("#price-range") →返回对象的空数组
  2. data('url-noprice') → is executed on each of the objects in the empty object array and returns 'undefined' data('url-noprice') →在空对象数组中的每个对象上执行,并返回'undefined'
  3. .replace(/&/g, '&') → is executed on 'undefined' .replace(/&/g, '&') →在'undefined'上执行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM