我购买了一个视频播放器,一旦在我的页面上实现,就会导致页面上所有其他JS功能出现问题。
在错误控制台中我收到此消息 - "错误:TypeError:$不是函数"
这是引起问题的视频播放器脚本。
<script type="text/javascript">
var hap_players = [];
jQuery(document).ready(function($) {
/* SETTINGS */
var rvp_settings = {
/* mediaId: unique string for player identification (if multiple player instances were used, then strings need to be different!) */
mediaId:'player1',
/* useDeeplink: true, false */
useDeeplink:false,
/*activePlaylist: Active playlist to start with. If no deeplink is used, enter element 'id' attribute, or if deeplink is used enter (data-address) deeplink string like 'playlist1'. */
activePlaylist:'playlist13',
/*activeItem: Active video to start with. Enter number, -1 = no video loaded, 0 = first video, 1 = second video etc */
activeItem:0,
/* GENERAL SETTINGS */
/*defaultVolume: 0-1 */
defaultVolume:0.5,
/*autoPlay: true/false (defaults to false on mobile)*/
autoPlay:true,
/*randomPlay: true/false */
randomPlay:false,
/* loopingOn: on playlist end rewind to beginning (last item in playlist) */
loopingOn: true,
/*autoAdvanceToNextVideo: true/false (use this to loop video) */
autoAdvanceToNextVideo:true,
/*autoOpenDescription: true/false */
autoOpenDescription:false,
usePlaylist:true,
useControls:true,
/*autoHideControls: auto hide player controls on mouse out: true/false. Defaults to false on mobile. */
autoHideControls:false,
/*controlsTimeout: time after which controls and playlist hides in fullscreen if screen is inactive, in miliseconds. */
controlsTimeout:3000,
/*playlistOrientation: vertical/horizontal */
playlistOrientation:'horizontal',
/*scrollType: scroll/buttons */
scrollType:'buttons',
/* YOUTUBE SETTINGS */
ytAppId:'AIzaSyDeqvaVCC5GEldPL1uOpI04h9sFoeH7WlY',/* youtube api key: https://developers.google.com/youtube/registering_an_application */
ytTheme:'dark',
ytShowinfo:true,
/*playlistList: dom element which holds list of playlists */
playlistList:'#playlist_list',
/* showControlsInAdvert: true/false (show controls while video advert plays) */
showControlsInAdvert:true,
/* disableSeekbarInAdvert: true/false (disable seekbar while video advert plays) */
disableSeekbarInAdvert:true,
/* showSkipButtonInAdvert: true/false (show skip button while video advert plays) */
showSkipButtonInAdvert:true,
advertSkipBtnText:'SKIP AD >',
advertSkipVideoText:'You can skip to video in',
logoPath: 'http://www.interactivepixel.net/images/jqueryPreviews/helper/apvplp_logo.png',
logoPosition: 'tl',/* tl, tr, bl, br */
logoXOffset: 5,
logoYOffset: 5,
logoUrl: 'http://www.google.com',
logoTarget: '_blank',
useShare: true,
/*fsAppId: facebook application id (if you use facebook share, https://developers.facebook.com/apps) */
fsAppId:'644413448983338'
};
hap_players[0] = $('#mainWrapper').aprvp(rvp_settings);
});
</script>
我尝试使用&#34; $(文档).ready(function(){})包装该脚本;&#34;但那没用。仍有JS问题和错误。
我一直试图弄清楚这两天,但没有运气。谢谢!
答案 0 :(得分:0)
从中删除美元。
jQuery(document).ready(function($) {
答案 1 :(得分:0)
确保您的jQuery脚本标记放在您的视频播放器脚本标记之前的页面上。