Jump to content

Archived

This topic is now archived and is closed to further replies.

tsalstrand

Adding jQuery - Syntax Error

Recommended Posts

tsalstrand

Here is what I'm putting into the custom CSS on my DMS2 install: http://paste.pagelines.com/ZHufi691

 

However, I'm returning uncaught syntaxerror every time. I found this article: http://www.pagelinestheme.com/adding-jquery-code-dms-editor/ but I think that's wrong.  When I put

 jQuery(document).ready(function() { ... })

DMS editor won't load. However, when I do $(document).ready(function() { }); it works (i.e. DMS editor loads) except I get the syntaxerror and the script doesn't work. 

 

I'm slightly confused how I should call in custom jQuery in DMS.  Could you please correct me on the syntax?

 

Thanks in advance!

Share this post


Link to post
Share on other sites
tsalstrand

OK, I solved it about 15 minutes after posting, so I want to share in case anyone else comes across this problem.  This is the proper syntax: 

jQuery(function(){ jQuery('.class').diffclass('/image.jpg'); });

The main thing is that it needed jQuery instead of $ in BOTH places.

 

As an aside - I also got Backstretch working. This is the jQuery library that Adam Munns used in his awesomely free Superfade plugin for Pagelines Framework.  However, it didn't work in DMS2.X because of jQuery conflicts. DMS2 uses jQuery 1.11.0 whereas Framework used 1.8.3 (I think). To get Backstretch working with 1.11.0 (since that's what DMS2 uses), on line 21-23 of jquery.backstretch.js change to the following:

if ($(window).scrollTop() === 0 ) {
$('body').scrollTop(0);
}

I'm posting in case anyone else wants to use this awesome jQuery plugin.

Share this post


Link to post
Share on other sites
Danny

Thanks for informing us the issue has been resolved and for sharing.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites

×