View Full Version : Javascript Problem

09-28-2012, 07:34 AM

I set one Image sliver in my site BLog.

URL : http://cata.mmascot.com/blog/

Slider Is working But their is error in my jquery generate in consol with every browser.

Mostly I want to solve it in Firefox and Chrome browser.

Error is :

In chrome : Uncaught TypeError: Object function (a,b){return new c.fn.init(a,b);} has no method 'backstretch' /blog/:85
(anonymous function)

In Firefox :

TypeError: jQuery.backstretch is not a function
[Break On This Error]

Please help me how can i solve it ?

Thanks in Advance.

09-28-2012, 07:52 AM
it looks like you're not actually declaring a function named backstretch. Are you sure that it is an actual function?

09-28-2012, 09:15 AM
it looks like you're not actually declaring a function named backstretch. Are you sure that it is an actual function?

I am using this jquery search from google. So , jquery is come with that slider.

Slider Is working properly..but consol create this error.
That i want to remove.
I m not declare that method or function.

09-28-2012, 09:19 AM
after a quick search, backstretch() is a jquery plugin that you will need to download and link to the page

09-28-2012, 09:45 AM
He's already referencing the backstretch plugin in his code.

09-28-2012, 01:52 PM
Right, the problem is that backstretch is declared on jQuery v 1.6.1 here:

. . . rnate" type="application/rss+xml" title="Cata's Blog in the Works » Feed" href="http://cata.mmascot.com/feed/" />
<link rel="alternate" type="application/rss+xml" title="Cata's Blog in the Works &raquo; Comments Feed" href="http://cata.mmascot.com/comments/feed/" />
<script type='text/javascript' src='http://cata.mmascot.com/wp-includes/js/l10n.js?ver=20101110'></script>
<script type='text/javascript' src='http://cata.mmascot.com/wp-includes/js/jquery/jquery.js?ver=1.6.1'></script>
<script type='text/javascript' src='http://cata.mmascot.com/wp-includes/js/comment-reply.js?ver=20090102'></script>
<script type='text/javascript' src='http://cata.mmascot.com/wp-content/themes/sideways/js/jquery.backstretch.min.js?ver=3.2.1'></script>
<script type='text/javascript' src='http://twitterjs.googlecode.com/svn/trunk/src/twitter.min.js?ver=3.2.1'></script>
<script type='text/javascript' src='http://cata.mmascot.com/wp-content/plugins/google-analyticator/external-tracking.min.js?ver=6.2'></script>
<link rel='index' title='Cata's Blog in the Works' href='http://cata.mmascot.com/' />
<!-- Google Analytics Tracking by Google Analyticator 6.2: http://ronaldheft . . .

But then later in the code, jQuery is redefined here as version 1.4.2:

. . . tent" class="clearfix">

<div class="article-wrapper clearfix" style="font-family:'Dosis', sans-serif;">
<!-- Slider -->
<script src="http://cata.mmascot.com/wp-content/themes/sideways/js/jquery.js" type="text/javascript"></script>
<script src="http://cata.mmascot.com/wp-content/themes/sideways/js/mobilyslider.js" type="text/javascript"></script>
<script src="http://cata.mmascot.com/wp-content/themes/sideways/js/init.js" type="text/javascript"></script>
<!--<script type="text/javascript" src="/js/jquery_003.js"></script>-->
<div class="slider">
<div class="sliderContent">
<div class="item"><img src="http://cata.mmascot.com/wp-content/themes/sideways/images/slider-01.png" alt="" /></div>
<div class="item"><img src="http://cata.mmascot.com/wp-content/themes/sideways/images/slider-02.png" alt="" /></div>
<div class="item"><img src="http://cata.mmascot.com/wp-content/themes/sideways/images/slider-03.png" alt="" /></div>
<div class="item"><img src="http://cata.mmascot.com/wp-content/themes/sideways/images/slider-04.png" alt="" /></div>
<div class="item"><img src="http://cata.mmascot.com/wp-content/themes/sideways/images/slider-05.png" alt="" /></div>

<!-- SIDEBAR -->
<ul id="article-sid . . .

Once that happens, any extensions to jQuery, such as backstretch are lost because jQuery itself is overwritten with another copy of jQuery that doesn't have those extensions.

The simplest solution if it works is to get rid of the second external script tag to jQuery, in this case the 1.4.2 version one. If things work out, the mobilyslider.js will happily use the version 1.6.1 code, though I would suggest updating that to the more stable 1.6.4 version.

But there could also be other problems.

The browser cache may need to be cleared and/or the page refreshed to see changes.