Conflict with an external script
-
I have a script like:
pagination.js
var busy = false; jQuery(window).scroll(function () { if (jQuery(window).scrollTop() > 300) { jQuery('#scrollUp').stop().animate({ opacity: 0.05 }, 400) } else { jQuery('#scrollUp').stop().animate({ opacity: 0.00 }, 400) } if (jQuery(window).scrollTop() + jQuery(window).height() > jQuery('#main_content').offset().top + jQuery('#main_content').height() - 50 && !busy) { busy = true; link = jQuery('.pagination .nextpage').attr('href'); if (typeof link != 'undefined') { var params = 'smt_layout=' + jQuery('body').attr('layout') + '&ajaxpage=1'; jQuery.ajax({ type: "POST", cache: false, async: false, data: params, url: link, dataType: 'json', success: function (data) { if (data != "") { jQuery('.pagination .nextpage').parent().append('<span class="thispage">Page ' + jQuery('.pagination .nextpage').attr('alt') + '</span>'); jQuery('.pagination .nextpage').remove(); jQuery("#main_content").append(data['content']); busy = false } } }) } } }); jQuery('#scrollUp').live('mouseenter', function () { jQuery(this).stop().animate({ opacity: 0.1 }, "slow") }).live('mouseout', function () { if (jQuery(window).scrollTop() > 300) var o = 0.05; else var o = 0.00; jQuery(this).stop().animate({ opacity: o }, "slow") }); jQuery('#scrollUp').live('click', function () { jQuery('html, body').animate({ scrollTop: 0 }, 1200); });
I’m using a Magnific Popup on Photonic Gallery Plugin:
and I get an error (Google Chrome Console): Uncaught TypeError: Cannot read property ‘top’ of undefined at pagination.js
It seems that the script is failing on this: jQuery(‘#main_content’).offset().top. Is there a way to resolve this problem? Thank you in advance.
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Conflict with an external script’ is closed to new replies.