-1
이 jquery 전체 화면 플러그인이 있습니다. 비록 내가 모든 표준을 따르고 있지만 그에게주는 것은 jquery not defined
오류입니다. 나는 무엇을해야할지 모른다.다음 표준 이후에도 Jquery가 충돌합니다.
다음은 html로 인라인 된 코드입니다.
(function($){
$(document).ready(function(){
$("#fsButton").click(function(e){
// Use the plugin
$("#content").fullScreen();
e.preventDefault();
});
});
}(jQuery));
이
은 참고로 내가 드루팔 사이트에서 이것을 사용하고있는 HTML/**
* @name jQuery FullScreen Plugin
* @author Martin Angelov
* @version 1.0
* @url http://tutorialzine.com/2012/02/enhance-your-website-fullscreen-api/
* @license MIT License
*/
(function($){
// Adding a new test to the jQuery support object
$.support.fullscreen = supportFullScreen();
// Creating the plugin
$.fn.fullScreen = function(props){
if(!$.support.fullscreen || this.length != 1){
// The plugin can be called only
// on one element at a time
return this;
}
if(fullScreenStatus()){
// if we are already in fullscreen, exit
cancelFullScreen();
return this;
}
// You can potentially pas two arguments a color
// for the background and a callback function
var options = $.extend({
'background' : '#111',
'callback' : function(){}
}, props);
// This temporary div is the element that is
// actually going to be enlarged in full screen
var fs = $('<div>',{
'css' : {
'overflow-y' : 'auto',
'background' : options.background,
'width' : '100%',
'height' : '100%'
}
});
var elem = this;
// You can use the .fullScreen class to
// apply styling to your element
elem.addClass('fullScreen');
// Inserting our element in the temporary
// div, after which we zoom it in fullscreen
fs.insertBefore(elem);
fs.append(elem);
requestFullScreen(fs.get(0));
fs.click(function(e){
if(e.target == this){
// If the black bar was clicked
cancelFullScreen();
}
});
elem.cancel = function(){
cancelFullScreen();
return elem;
};
onFullScreenEvent(function(fullScreen){
if(!fullScreen){
// We have exited full screen.
// Remove the class and destroy
// the temporary div
elem.removeClass('fullScreen').insertBefore(fs);
fs.remove();
}
// Calling the user supplied callback
options.callback(fullScreen);
});
return elem;
};
// These helper functions available only to our plugin scope.
function supportFullScreen(){
var doc = document.documentElement;
return ('requestFullscreen' in doc) ||
('mozRequestFullScreen' in doc && document.mozFullScreenEnabled) ||
('webkitRequestFullScreen' in doc);
}
function requestFullScreen(elem){
if (elem.requestFullscreen) {
elem.requestFullscreen();
}
else if (elem.mozRequestFullScreen) {
elem.mozRequestFullScreen();
}
else if (elem.webkitRequestFullScreen) {
elem.webkitRequestFullScreen();
}
}
function fullScreenStatus(){
return document.fullscreen ||
document.mozFullScreen ||
document.webkitIsFullScreen;
}
function cancelFullScreen(){
if (document.exitFullscreen) {
document.exitFullscreen();
}
else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
}
else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
}
}
function onFullScreenEvent(callback){
$(document).on("fullscreenchange mozfullscreenchange webkitfullscreenchange", function(){
// The full screen status is automatically
// passed to our callback as an argument.
callback(fullScreenStatus());
});
}
})(jQuery);
에서 참조하는 플러그인입니다. 그러나 이것은 자바 스크립트 문제가 될 것 같습니다.
html 페이지에 (작동중인) jQuery 파일에 대한 링크를 포함시켜야합니다. 먼저 [library] (https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js)로 연결 한 다음 사용할 jQuery 플러그인으로 연결하십시오. 여러분이 이미 이것을 알지는 못하지만, jQuery가 정의되지 않은 에러가 발생했을 때 상상할 수있는 유일한 이유는/ –
입니다. 여러분이 가지고있는 코드가'jquery'를 전혀 참조하지 않기 때문에 문제가 다른 곳에 있다고 (또는 오류를 잘못보고하고 있음). – Quentin
페이지에 jquery가 있습니까? – Starx