Note that there are some explanatory texts on larger screens.

plurals
  1. POjavascript function disabling and/or conflicting with fancybox
    primarykey
    data
    text
    <p>Being a bit of a javascript/jQuery noob, I've run into a problem that I can't find a solution for. </p> <p>I have a function that grabs some parameters from the url and replaces elements. All good. I also have instances of FancyBox on the page. </p> <p>It semms something in my getUrlVars function is killing FancyBox. If I load FancyBox first in the document ready, it just loads the larger pic into a new browser window, like a regular link. If I grab the URL vars and let them do their thing before loading FancyBox, the links do nothing at all. </p> <p>I've tried running both in isolation and they work perfectly, until I try to run them both.</p> <p>Here's the getUrlVars script...</p> <pre><code>function getUrlVars() { var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&amp;'); for(var i = 0; i &lt; hashes.length; i++) { hash = hashes[i].split('='); vars.push(hash[0]); vars[hash[0]] = hash[1]; } return vars; } var salesname = getUrlVars()["agent"]; var salesname = unescape(salesname); var vendor = getUrlVars()["vendor"]; var vendor = unescape(vendor); var position = getUrlVars()["position"]; var position = unescape(position); $('h1:contains("thisiswherethevendorgoes")').html( '&lt;span class = "fade-in one"&gt; &lt;strong&gt;Prepared for ' + vendor + '&lt;/strong&gt;&lt;/span&gt;'); $("body").html($("body").html().replace(/salesname/g, salesname + ', ' + position)); }); </code></pre> <p>Before or after (I've tried every permutation) I setup FancyBox...</p> <pre><code>$("a#fbs").fancybox({ 'opacity' : true, 'overlayShow' : true, 'transitionIn' : 'elastic', 'easingIn' : 'easeInCirc', 'transitionOut' : 'elastic', 'easingOut' : 'easeOutCirc', 'speedIn' : 500, 'speedOut' : 250 }); </code></pre> <p>Both have to run (I think?) inside $(document).ready(function() {</p> <p>Any clues? Any and all suggestions much appreciated.</p>
    singulars
    1. This table or related slice is empty.
    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