good day! did http://ckeditor.com/addon/lightbox instruction, have produces error (when press button lightbox): uncaught typeerror: cannot read property 'split' of undefined
code:
<!doctype html> <!-- copyright (c) 2003-2015, cksource - frederico knabben. rights reserved. licensing, see license.md or http://ckeditor.com/license --> <html> <head> <meta charset="utf-8"> <title>replace textarea code — ckeditor sample</title> <script src="../ckeditor.js"></script> <script src="../jquery-1.11.0.min.js"></script> <link href="sample.css" rel="stylesheet"> <link rel="stylesheet" href="lightbox.css"> </head> <body> <h1 class="samples"> <a href="index.html">ckeditor samples</a> » replace textarea elements using javascript code </h1> <form action="sample_posteddata.php" method="post"> <div class="description"> <p> editor using <code><iframe></code> element-based editing area, provided <strong>wysiwygarea</strong> plugin. </p> <pre class="samples"> ckeditor.replace( '<em>textarea_id</em>' ) </pre> </div> <textarea cols="80" id="editor1" name="editor1" rows="10"> </textarea> <script> ckeditor.replace( 'editor1' ); </script> <p> <input type="submit" value="submit"> </p> </form> <div id="footer"> <hr> <p> ckeditor - text editor internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> </p> <p id="copy"> copyright © 2003-2015, <a class="samples" href="http://cksource.com/">cksource</a> - frederico knabben. rights reserved. </p> </div> <script type="text/javascript"> $(document).ready(function(){ ckelightbox(); }); function ckelightbox(){ var c=0; $('a.ckelightbox').each(function(){ c++; var g=$(this).attr('class').split('ckelightboxgallery')[1]; if(!g)g=c; $(this).attr('data-lightbox',g); $(this).attr('data-title',$(this).attr('title')); }); } </script> </body> </html>
all scripts loaded - http://take.ms/2jnx8
could please provide working example?
this test project - http://take.ms/ojpke
i same error. plugin doesn't work. particular error happening due variable gal not being defined on line 20 of dialogs/lightbox.js (although same apply lines 21 , 22). however, if check undefined:
if(typeof gal !== 'undefined') {gal = gal.split("ckelightboxgallery"); gal = gal[1]; a.advanced && this.setvalue(gal || ""); }
...it still doesn't work. i'm pretty sure problem has code:
<script> $(document).ready(function(){ ckelightbox(); }); function ckelightbox(){ var c=0; $('a.ckelightbox').each(function(){ c++; var g=$(this).attr('class').split('ckelightboxgallery')[1]; if(!g)g=c; $(this).attr('data-lightbox',g); $(this).attr('data-title',$(this).attr('title')); }); } </script>
...because when use lightbox , identify title test1 , gallery test, generates code this:
<p><a class="ckelightbox ckelightboxgallerytest" href="myimage.jpg" title="test1">myimage.jpg</a></p>
i think idea of above code grab ckelightboxgallerytest , split out "test" can turn data-lightbox="test."
Comments
Post a Comment