才能显示Slick轮播的图片

才能显示Slick轮播的图片

本文介绍了现在,只有从成功的Facebook Connect返回后,才能显示Slick轮播的图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Slick轮播作为此推荐信箱:

I am using Slick carousel for this testimonials box:

我有此按钮可以使用Facebook登录:

I have this button to log in using Facebook:

在成功登录Facebook Connect之后,Slick轮播仍然可以正常工作,但是所有图片都被破坏了:

Immediately after a successful Facebook Connect login, the Slick carousel still works but all pictures are broken:

例如,如果我通过单击主页的徽标来重新加载页面,从而四处浏览,则所有内容均已修复,并且图片再次正确显示.造成此错误的原因是什么?我注意到,使用Facebook登录后,URL更改为 https://example.net/San-salvador/ https://example.net/San-salvador/# = .我以为附加的# = 可能是问题的原因,我使用此JavaScript代码将其删除:

If I click around for example by clicking the logo of the home page to reload the page, everything is fixed and the pictures appear again correctly. What could be the cause of this bug? I noticed that after logging in with Facebook, the URL changes from https://example.net/San-salvador/ to https://example.net/San-salvador/#=. I thought that this #= that is appended might be the cause of the problem and I used this JavaScript code to remove it:

jQuery(document).ready(function($) {
    // Remove #_=_ string from URL when using Facebook Connect.
    if (window.location.href.indexOf('#_=_') > 0) {
        window.location = window.location.href.replace(/#.*/, '');
    }
    ....
    ....
    ....
}

# = 不再附加到URL,Facebook Connect仍然可以正常工作,但是该错误未得到修复.任何人也遇到此错误并知道解决方法了吗?

The #= is not appended to the URL anymore, Facebook Connect still works correctly, but the bug is not fixed. Anyone experiencing this bug too and knowing the fix?

我正在使用Facebook PHP SDK(v.3.2.3): https://github .com/facebookarchive/facebook-php-sdk .我知道它已被弃用,但这可能是我遇到此错误的原因吗?

I am using Facebook PHP SDK (v.3.2.3): https://github.com/facebookarchive/facebook-php-sdk. I know it is deprecated, but could that be the reason why I am experiencing this bug?

推荐答案

检查以下内容以找出到底出了什么问题:

Check the following things to figure out what exactly goes wrong:

  • 您是否已检查浏览器控制台以查看其内容?
  • 图片URL是否像您期望的那样在其中提及?
  • 您如何在代码中引用图像-相对URL,相对于域根目录,是绝对的?

如果主文档的URL发生了变化(同时在注释中指出),那么最好的选择可能是使用相对于域根目录的图像URL,以反斜杠开头:

If the main document URL changes (as figured out in the meantime, in comments), then your best bet is probably to use image URLs that are relative to the domain root, beginning with a leading slash:

/path/to/images/file.jpg

-无论当前页面的URL路径是什么,它总是指向相同的位置.

- no matter what the URL path of the current page is, this will always point to the same location.

这篇关于现在,只有从成功的Facebook Connect返回后,才能显示Slick轮播的图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 09:03