Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamic page/replace content and jQuery conflict
    primarykey
    data
    text
    <p>I've read several posts on SO on similar subjects, but was unable to dissect and get my code to function the way I want it too.</p> <p>I'm creating an app where page content is changed and replaced dynamically. This is the link to the plug-in I used (yes, I tried contacting the developer who programmed the script, but to no-avail). (css-tricks.com/dynamic-page-replacing-content)</p> <p>It all works the way it should until I try implementing separate jQuery within {div id="guts"}. For example, I'm trying to add this script, but it's not activating. In fact, no other jQuery script will work within this DIV. (digitalbush.com/projects/masked-input-plugin)</p> <p>There appears to be some conflict, especially with the hashchange script. I believe this is the source. If I disable the hashchange/dynamic page script, the masked input script works like it should.</p> <p>Here's the link to the application I'm working on. This is with the hash-change activated. And if you click the menu items, it changes as it should. However, the masked input does NOT work - and it should active on the "phone number" input field. <a href="http://socialbungy.com/newsite/sweeps_temp_facebook/TAB_TEMP1/#enter.php" rel="nofollow">http://socialbungy.com/newsite/sweeps_temp_facebook/TAB_TEMP1/#enter.php</a></p> <p>If you remove the hashmark in the URL, the page loads and the masked input on the phone number field now works as it should, however the dynamic page functionality is gone. <a href="http://socialbungy.com/newsite/sweeps_temp_facebook/TAB_TEMP1/enter.php" rel="nofollow">http://socialbungy.com/newsite/sweeps_temp_facebook/TAB_TEMP1/enter.php</a></p> <p>So I know this is the problem, I just can't figure out how to prevent the conflict. If you look at the page source of /#enter.php you'll notice the source code for /index.php, not /enter.php. It think this is also a factor. Is this why the script not initiating?</p> <p>If you guys (and gals?) need my code posted here, which would be a lot, I will. Figured it might be easier to assist with the links, so you can see the structure.</p> <p>What am I doing wrong? Btw, the pages may be php, but there's no php code within it.</p> <p><strong>EDIT:</strong> Here's the suspected bad code.</p> <pre><code>$(function() { var reloadMask = function reloadMask() { $(document).ready(function() { $("#phone").mask("(999) 999-9999"); }); } var newHash = "", $mainContent = $("#appContent"), $pageWrap = $("#page-wrap"), baseHeight = 0, $el; $pageWrap.height($pageWrap.height()); baseHeight = $pageWrap.height() - $mainContent.height(); $("nav").delegate("a", "click", function() { window.location.hash = $(this).attr("href"); return false; }); $("#buttonWrap").delegate("a", "click", function() { window.location.hash = $(this).attr("href"); return false; }); $(window).bind('hashchange', function(){ newHash = window.location.hash.substring(1); if (newHash) { $mainContent .find("#guts") .slideToggle(500, function() { $mainContent.hide().load(newHash + " #guts", function() { $mainContent.slideToggle(500, function() { $pageWrap.animate({ height: baseHeight + $mainContent.height() + "px" }); }); $("nav a").removeClass("current"); $("nav a[href="+newHash+"]").addClass("current"); }); }); }; }); $(window).trigger('hashchange'); reloadMask(); </code></pre> <p>}); </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload