jQuery代码在Wordpress帖子中不起作用

时间:2018-10-18 18:08:30

标签: jquery wordpress plugins

我正在尝试使用此脚本来翻转嵌入式图像地图插件中的图像,但是它根本无法正常工作。该代码已放置在插件的相关js文件中,该文件无法正常工作-现在已尝试将其放在RawJS组件中(将js插入wp页面),但仍然没有。谁能看到此代码有问题吗?

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
(function($, window, document, undefined) {

$.imageMapProEventHighlightedShape = function(imageMapName, shapeName)

{

if (shapeName == 'gherkin') { $('#image-map-pro-6376.imp-main-image').attr('src', 'https://www.private.com/wp-content/uploads/2018/10/Gherkin2-1.png'); }

if (shapeName == 'stpauls') { $('#image-map-pro-6376.imp-main-image').attr('src', 'https://www.private.com/wp-content/uploads/2018/10/st-paul.jpg'); }

if (shapeName == 'shard') { $('#image-map-pro-6376.imp-main-image').attr('src', 'https://www.private.com/wp-content/uploads/2018/10/shard.jpg'); }

if (shapeName == 'stadium') { $('#image-map-pro-6376.imp-main-image').attr('src', 'https://www.private.com/wp-content/uploads/2018/10/stadium.jpg'); }


$.imageMapProEventUnhighlightedShape = function(imageMapName, shapeName) {

$('#image-map-pro-6376.imp-main-image').attr('src', 'https://www.private.com/wp-content/uploads/2018/10/all-in-one.jpg');

};
};

})(window, document);
</script>

0 个答案:

没有答案