Question: Calling JQuery and plugins? I am diving into javascript and I am attemptin

Discussion in 'jQuery' started by MMOgrl, Nov 18, 2008.

  1. #1
    Question: Calling JQuery and plugins?

    I am diving into javascript and I am attempting to use:

    JQuery
    http://jquery.com/

    and CrossSlide
    http://www.gruppo4.com/~tobia/cross-slide.shtml

    I have created test.html to get to know javascript better. However I seem to not be calling these scripts correctly.

    Can you review the code below and tell me where I am messing up? Thank you, I am usually quick to pick up on things and always eager to learn!

    ---

    <html>
      <head>
    <script src='jsparty/jquery.js' type='text/javascript'></script>
    	<script type='text/javascript'>//<![CDATA[
    		$(function() {
    			if ($.browser.ie && $.browser.version < 8)
    				$('<span>&#9658;</span>').prependTo('kbd');
    			if ($.browser.ie && $.browser.version < 7 || $.browser.safari && $.browser.version < 600)
    				$('#menu a').hover(function() {
    					$(this).next().show();
    				}, function() {
    					$(this).next().hide();
    				});
    		});
    	//]]></script>
    
      </head>
      <body>
    
    <script src='jsparty/jquery.cross-slide.js' type='text/javascript'></script>
    <script type='text/javascript'>//<![CDATA[
      function displaySource(name) {
        $('<pre>'
            + $('#source-' + name).html() // $(<script>).text() is broken on IE 5
                .replace(/^\s*|\s*$/g, '')
                .split('\n').slice(2, -2).join('\n')
                .replace(/( \/\/.*)/g, '<i>$1</i>')
            + '</pre>')
          .insertAfter('#display-' + name);
      }
    //]]></script>
    
    
    
    <script type='text/javascript' id='source-test1'>//<![CDATA[
    $(function() {
    $('#test1').crossSlide({
      speed: 45, //in px/sec
      fade: 1    //in sec
    }, [
      { src: 'http://icanhascheezburger.files.wordpress.com/2007/04/oh-hi-i-losted-yr-page-lulz2.jpg', dir: 'up'   },
      { src: 'http://www.gruppo4.com/~tobia/lib/sunflower.jpeg',   dir: 'down' },
      { src: 'http://www.gruppo4.com/~tobia/lib/flip-flops.jpeg',  dir: 'up'   },
      { src: 'http://www.gruppo4.com/~tobia/lib/rubber-ring.jpeg', dir: 'down' }
    ]);
    });
    //]]></script>
    
      </body>
      </html>
    Code (markup):
     
    MMOgrl, Nov 18, 2008 IP
  2. rene7705

    rene7705 Peon

    Messages:
    233
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2


    <html>
      <head>
    <script src='jsparty/jquery.js' type='text/javascript'></script>
    <script src='jsparty/jquery.cross-slide.js' type='text/javascript'></script>
    <script type='text/javascript'><!--
    	function displaySource(name) {
    		$('<pre>'+ 
    		$('#source-' + name).html() // $(<script>).text() is broken on IE 5
    			.replace(/^\s*|\s*$/g, '')
    			.split('\n').slice(2, -2).join('\n')
    			.replace(/( \/\/.*)/g, '<i>$1</i>')
    			+ '</pre>')
    			.insertAfter('#display-' + name);
    	}
    --></script>
    
    <script type='text/javascript'><!--
    	$document.ready(function() {
    	if ($.browser.ie && $.browser.version < 8) $('<span>â–º</span>').prependTo('kbd');
    	if ($.browser.ie && $.browser.version < 7 || $.browser.safari && $.browser.version < 600)
    		$('#menu a').hover(function() {
    			$(this).next().show();
    		}, function() {
    			$(this).next().hide();
    		});
    	});
    	$('#test1').crossSlide({
    		speed: 45, //in px/sec
    		fade: 1    //in sec
    		}, [
    		{ src: 'http://icanhascheezburger.files.wordpress.com/2007/04/oh-hi-i-losted-yr-page-lulz2.jpg', dir: 'up'   },
    		{ src: 'http://www.gruppo4.com/~tobia/lib/sunflower.jpeg',   dir: 'down' },
    		{ src: 'http://www.gruppo4.com/~tobia/lib/flip-flops.jpeg',  dir: 'up'   },
    		{ src: 'http://www.gruppo4.com/~tobia/lib/rubber-ring.jpeg', dir: 'down' }
    	]);
    });	
    --></script>
    
    
      </head>
      <body>
    
      </body>
      </html>
    Code (markup):
    That thing with [CDATA looked real strange to me..
     
    rene7705, Nov 18, 2008 IP