Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-05-2012, 03:51 PM   PM User | #1
m2244
Regular Coder

 
Join Date: Jun 2012
Posts: 129
Thanks: 1
Thanked 1 Time in 1 Post
m2244 is an unknown quantity at this point
Do I need to upgrade jQuery

I have been having some problems with jQuery this morning. I was able to get .live to work for a click but I have tried many different things for hover or mouseenter, etc with no luck.

I tried to upgrade to a newer version of jQuery(I have no idea if I even did it correctly). When I tried this upgrade, all of a sudden it seemed like 'return false' was not working.

Any help would be very much appreciated. I am trying to button up many projects today.

Code:
$('a.glossaryLink').live("hover", function(){
		onRollOverPULink();
		return false;	
	});
Code:
 * jQuery JavaScript Library v1.3.2
 * http://jquery.com/
 *
 * Copyright (c) 2009 John Resig
 * Dual licensed under the MIT and GPL licenses.
 * http://docs.jquery.com/License
 *
 * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
 * Revision: 6246
This is the one I tried today.
Code:
/*! jQuery v1.7.2 jquery.com | jquery.org/license */
m2244 is offline   Reply With Quote
Old 10-05-2012, 03:58 PM   PM User | #2
xelawho
Senior Coder

 
xelawho's Avatar
 
Join Date: Nov 2010
Posts: 2,437
Thanks: 52
Thanked 453 Times in 451 Posts
xelawho will become famous soon enoughxelawho will become famous soon enough
Quote:
As of jQuery 1.7, the .live() method is deprecated. Use .on() to attach event handlers. Users of older versions of jQuery should use .delegate() in preference to .live().
http://api.jquery.com/live/

Fwiw, I think the latest jQuery is 1.8.something
xelawho is offline   Reply With Quote
Old 10-05-2012, 06:09 PM   PM User | #3
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
you want somethign like this: ( using 1.7+)


Code:
$('a.glossaryLink').on("hover", function(e){
		onRollOverPULink();
	});
no need for the return false on a hover
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Old 10-05-2012, 06:12 PM   PM User | #4
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,599
Thanks: 5
Thanked 865 Times in 842 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
Also, the most recent version is 1.8.2, you can download it with the click of a button on http://jquery.com/ and just replace your old file.

Also, in order to give you most helpful advice it would help us if you showed us all your code, that is HTML and JS, ideally with a link to a live example.
__________________
Don’t click this link!
VIPStephan is online now   Reply With Quote
Old 10-05-2012, 07:13 PM   PM User | #5
m2244
Regular Coder

 
Join Date: Jun 2012
Posts: 129
Thanks: 1
Thanked 1 Time in 1 Post
m2244 is an unknown quantity at this point
Quote:
Originally Posted by DanInMa View Post
you want somethign like this: ( using 1.7+)


Code:
$('a.glossaryLink').on("hover", function(e){
		onRollOverPULink();
	});
no need for the return false on a hover
Why is this still not working correctly? In IE I get 2 alerts each time I hover. In FF I don't get any.

This div is populated using JS.
Code:
	<div id="containerContainer">
		<!--[if IE 6]><br/><br/><![endif]-->
		<div id="contentContainer"></div>
		<div id="flow"></div>
	</div>
This is the HTML content that is added to the div above.
Code:
<ul>
  <li>
    	(U) Spiral 1.5: <a class="glossaryLink" href="#">SCCVI</a> and <a class="glossaryLink" href="#">SCRI</a>  </li>
  <li> (U) Spiral 2:  <a class="glossaryLink" href="#">HBSS</a>  </li>
</ul>
THis is the JS function that loads the html content.
Code:
function loadDivHTML(div_id, content_src)
{
	$("#" + div_id).load(content_src, bookmark);
	setGlossLinkListeners(); //Each time new content is loaded this function sets listeners on PU links.
}
Code:
function setGlossLinkListeners()
{
$('#contentContainer a.glossaryLink').on('hover', function(){
			onRollOverPULink(); 
	});
}

function onRollOverPULink() //e, txt
{
	alert("onRollOverPULink");
}
m2244 is offline   Reply With Quote
Old 10-05-2012, 07:20 PM   PM User | #6
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
when using .on, you should not need to contain the event listener in a function and recall the function everytime you load the div.

would it be possible to see the entire source code of the page? I have a feeling maybe you are implementing it incorrectly somehow.
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Old 10-05-2012, 07:41 PM   PM User | #7
m2244
Regular Coder

 
Join Date: Jun 2012
Posts: 129
Thanks: 1
Thanked 1 Time in 1 Post
m2244 is an unknown quantity at this point
Quote:
Originally Posted by DanInMa View Post
when using .on, you should not need to contain the event listener in a function and recall the function everytime you load the div.
I guess I do not follow. The HTML content is placed into the 'contentContainer' div. This HTML content may or may not have any number of <a> elements. Wouldn't I need to run the 'setGlossLinkListeners' function each time the content is loaded to the content div?

Here is the code on the main page.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>VTANG GUI</title>
		
	<script src="scripts/jquery_js/jquery.js" type="text/javascript" language="javascript"> </script>	
	<script src="scripts/jquery_js/jquery-ui/ui.core.js" type="text/javascript"></script>
	<script src="scripts/jquery_js/jquery-ui/ui.draggable.js" type="text/javascript"></script>
	<script src="scripts/jquery_js/jquery.xml2json.js" type="text/javascript" language="javascript"></script>
	<script src="scripts/classificationDiv.js" type="text/javascript" language="javascript"></script>
	
	<!-- This is Meridian code. Enables the index toggle functionality. -->
	<!--<script language="javascript" src="/KView/CustomCodeBehind/Base/Scripts/BaseJSFunctions.js" type="text/javascript"></script>
	<script language="javascript" src="/ig_common/scripts/ig_csom.js" type="text/javascript"></script>
	<script Language="javascript" src="/ig_common/webbars2/ig_weblistbar.js" type="text/javascript"></script>
	<script Language="javascript" src="/ig_common/WebNavigator3/ig_webmenu.js" type="text/javascript"></script>-->
	
	<script src="scripts/jquery_js/center.js" type="text/javascript" language="javascript"> </script>
	<script src="scripts/glossary_over_label.js" type="text/javascript" language="javascript"> </script>
	<script src="scripts/APIWrapper.js" type="text/javascript" language="javascript"></script>
	<!--<script src="scripts/vtang_pass_to_lms.js" type="text/javascript" language="javascript"></script>-->
	
	<script src="scripts/float_element.js" type="text/javascript" language="javascript"></script>
	<script src="scripts/vtang2.js" type="text/javascript" language="javascript"></script>
	<script src="scripts/swfobj/swfobject.js" type="text/javascript" language="javascript"></script>
	<script src="scripts/new_pup.js" type="text/javascript" language="javascript"></script>
	<script src="scripts/new_gloss.js" type="text/javascript" language="javascript"></script>
	<script src="scripts/sidetrack.js" type="text/javascript" language="javascript"></script>

	<link rel="stylesheet" type="text/css" title="default" href="styles/presentation.css" />	
	<link rel="stylesheet" type="text/css" href="styles/layout.css" />
	<link rel="stylesheet" type="text/css" href="styles/header_layout.css" />
	<link rel="stylesheet" type="text/css" href="styles/content_presentation.css" />
	<link rel="stylesheet" type="text/css" href="styles/glossary.css" />
	<link rel="stylesheet" type="text/css" href="styles/popup_layer.css" />
	<link rel="stylesheet" type="text/css" href="styles/new_pup.css" />
	<link rel="stylesheet" type="text/css" title="default" href="styles/banner_classification.css" />
	<link rel="stylesheet" type="text/css" title="default" href="styles/banner_fixed.css" />
	<link rel="stylesheet" type="text/css" title="default" href="styles/console_pres.css" />

</head>
<body><!--onUnload="JavaScript:setLessonStatus('completed')" SCORM API code for Meridian.-->

	<div id="fixedDiv">
		<div id="classificationHeader">
			<div id="centerClassifDiv"><p id="classificationText">Classification</p></div>
			<div id="courseTitle"></div>
	<div id="blockTitle"></div>
	<div id="pageTitle"></div>
		</div>
		<div id="banner" class="bannerImage"></div>
	</div>

	<!--	-->
	<!-- <div id="glossaryParent> -->
	<div id="glossaryContainer" style="left:225px;top:110px;display:none;">
	<div id="glossaryTop">
	<span class="glossaryTitle">Glossary</span><span class="glossary_searchTitle">Search:<input type="text" name="glossary_search" style="margin-left:10px;"></span>
	</div>
			<div onselectstart="return false;" id="Glossary_index">
			<a href="#">A</a>
			<a href="#">B</a>
			<a href="#">C</a>
			<a href="#">D</a>
			<a href="#">E</a>
			<a href="#">F</a>
			<a href="#">G</a>
			<a href="#">H</a>
			<a href="#">I</a>
			<a href="#">J</a>
			<a href="#">K</a>
			<a href="#">L</a>
			<a href="#">M</a>
			<a href="#">N</a>
			<a href="#">O</a>
			<a href="#">P</a>
			<a href="#">Q</a>
			<a href="#">R</a>
			<a href="#">S</a>
			<a href="#">T</a>
			<a href="#">U</a>
			<a href="#">V</a>
			<a href="#">W</a>
			<a href="#">X</a>
			<a href="#">Y</a>
			<a href="#">Z</a>
			</div>
			<div id="glossaryBar" onmousedown="dragStart(event, 'glossaryContainer')"><img class='glossary_four_arrow' src="course_assets/four_arrow.png"></img></div>
		<div id="glossaryContent">
		&nbsp;
		</div>

		<div id="glossaryClose"><a href="javascript:hideGlossary();"><img src="course_assets/x_out.png" width="18" height="18" border="0" /></a></div>
	</div>

	
	<!-- only displays if value passed for module_data.xml: block_text -->
	<div id="headerBlockContainer" class="blockLabel" ></div>

	<div id="containerContainer">
		<!--[if IE 6]><br/><br/><![endif]-->
		<div id="contentContainer"></div>
		<div id="flow"></div>
	</div>

	<div id="floatingConsol" name="floatingConsol">

		<div onselectstart="return false;" id="devConsole">
			<div id="devConsole_left_graphic">
			</div>
			<div id="console_center">
				<div id="devConsole_nav2">
					<a class="devConsoleNav" href="javascript:consolBtnClick('glossary');">Glossary</a>
					<a class="devConsoleNav" href="javascript:consolBtnClick('index');">Index</a>
					<a class="devConsoleNav" href="javascript:consolBtnClick('guide');">Course Guide</a>
				</div>
		<div id="scrubber">
			<ul id="scrubberList">
				<!--This is where the tick marks go for the page scrubber on the console.-->
			</ul>
		</div>
		<div id="page_display"><!--This is where page titles are siplayed on hover--></div>
		
		</div>
			<div id="next_prev_btn">
					<div id="prev_btn"><a class="prev_btn" href="javascript:goToPrev();"></a></div>
					<div id="dev_current_pages"></div>
					<div id="next_btn"><a class="next_btn" href="javascript:goToNext();"></a></div>
					<div id="dev_pages_total"></div>
			</div>
				</div>
	</div>
</body>
</html>
m2244 is offline   Reply With Quote
Old 10-05-2012, 07:51 PM   PM User | #8
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
oh my...
ok, no biggie but, language="javascript" , is deprecated, you can remove all those.

next, please show the contents of the js file that has the code you have been testing. new_gloss.js perhaps?
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users

Last edited by DanInMa; 10-05-2012 at 08:01 PM..
DanInMa is offline   Reply With Quote
Old 10-05-2012, 08:21 PM   PM User | #9
m2244
Regular Coder

 
Join Date: Jun 2012
Posts: 129
Thanks: 1
Thanked 1 Time in 1 Post
m2244 is an unknown quantity at this point
Quote:
Originally Posted by DanInMa View Post
next, please show the contents of the js file that has the code you have been testing. new_gloss.js perhaps?
Is there a way to attach a couple of files?
m2244 is offline   Reply With Quote
Old 10-05-2012, 08:25 PM   PM User | #10
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
just cut n paste, im sure it isnt too big. you can attach files but most folks dont like to download them ( im in that weird group)
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Old 10-05-2012, 08:52 PM   PM User | #11
m2244
Regular Coder

 
Join Date: Jun 2012
Posts: 129
Thanks: 1
Thanked 1 Time in 1 Post
m2244 is an unknown quantity at this point
This is a bit of a mess and there is a lot going on here. I wonder if my jQuery files are working 100%. I just tried to update to 1.7. Why would this work in IE and not FF.

Thanks very much for taking a look.

Code:
var mainTitle = document.title;
var course_name;
var block_text;
var pages_arr = [];
var defaultBlockTitle;
var current_pg_ind = 0;
var contentDiv_id = "contentContainer";
var isParsed = false; // failsafe for stupid IE
var jxml;
var glossaryOpen_b = false;
var popup_w = 420;
var popup_h = 360;
var popup_rad = 20;
var moduleData_url;

$(document).ready(function(){
	var path = getModuleDataUrl();

	$.get(path, function(success)
	{
		jxml = $.xml2json(success);
		parseJSON();
		init();
	});
});


		 
////////////////////////////////////////////////////////////////////////////////////////////////
//dev:

function dev(msg) { alert("dev :: \n\n" + msg); }

////////////////////////////////////////////////////////////////////////////////////////////////

// communication with Console:
function thisMovie(movieName)
{
//artf2008 IE 9 reverts to following web standards more closely.  Parse the version string and check the number for testing.
//Fetching number only and testing as integer so hopefully this patch can last more than one version if needed.
var ver = navigator.appVersion;
var ptr = ver.indexOf("MSIE")+5;
var chunk = ver.slice(ptr,ptr+4);
var vernum = chunk.slice(0,chunk.indexOf("."));
vernum = vernum*1;

    if (navigator.appName.indexOf("Microsoft") != -1 && vernum < 9) { return window[movieName] } else { return document[movieName] }
}

/*function initConsole()
{
	var c = thisMovie(consol_name);
	if (c == undefined)
	{
		//alert("ERROR :: Consol.swf is undefined. :: vtang2.js :: initConsol");
	} else if (consolIsReady && (pages_arr.length > 0)) {
		if (consolInit_int != "")
			{
				window.clearInterval(consolInit_int);
				consolInit_int = "";
			}
			var ind = parseInt(current_pg_ind) + 1;
			c.initLocation(pages_arr, ind);
	} else {
		if (consolInit_int == "")
		{
			consolInit_int = window.setInterval(function() 
			{ 
				initConsole();
			}, 1000);
		}
	}
}*/

/*function onConsolReady()
{
	//alert("onConsolReady");
	consolIsReady = true;
}*/

function requestPage(page_ind)
{	
	hidePup(); //Hide the new popup. MH
	hideGlossary();
	resetPageEle();
	var req = pages_arr[page_ind].url;
	var title = pages_arr[page_ind].title;
	var block_title;	
	if (pages_arr[page_ind].block_title != undefined)
	{
		block_title = pages_arr[page_ind].block_title;
	} else {
		block_title = defaultBlockTitle;
	}

	loadDivHTML(contentDiv_id, req); 
	$("#pageTitle").text(title);
	$("#blockTitle").text(block_title);
	$("#courseTitle").text(course_name);
	
	
	
	document.title = mainTitle; //This forces the tab title. Page errors will affect tab title if this is not set. 'mainTitle' var set at top of this script MH.
	
	//current_pg_ind = parseInt(page_ind);
	bookmark();
	checkClassification(); //Call the function to check content classification. Must be turned off when not needed MH.
}

function setGlossLinkListeners()
{
	/*$('#contentContainer a.glossaryLink').each(function() { 
		alert('this will alert for every li found.'); 
	}); */

	$('#contentContainer a.glossaryLink').on('hover', function(){
			onRollOverPULink();
	});
	/*$('a.glossaryLink').live("hover", function(event){
		alert("WTF");
	});
	.onmouseout(function(event){;
		onRollOutPULink(event);
	}).click(function(event){
		showHideGlossary();
	})*/
}

function consolBtnClick(id)
{
	switch (id)
	{
		case "glossary" :
			showHideGlossary();
			break;
		case "index" :
			//alert ("code not written: vtang2.js: consolBtnClick(id = 'index')");
			window.parent.close();
			//top.scorm_commnunication_form.showHideNav();
			break;
		case "guide" :
			openPopUpWindow('course_guide/pages/course_guide2.html', 'Course Guide', '750', '550');
			//showHidePup('course_guide/pages/course_guide2.html', 'Course Guide', '750', '550');
			break;		
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////		 
//glossary pod:

/*function showTerm(term)
{
	
	thisMovie("GlossaryPod").showTerm(term);
	//$('#glossaryContainer').css('zIndex', 131);
	window.setTimeout(GPOverPU, 200);
}*/

/*function toggleGlossaryPodOpen()
{
	alert("toggleGlossaryPodOpen :: glossaryOpen_b: " + glossaryOpen_b);
	if (glossaryOpen_b)
	{
		//closeGlossaryPod();
	} else {
		openGlossaryPod();
	}
}*/

function openGlossaryPod(term)
{
	$("#glossaryContainer").removeClass('glossaryHide').addClass('glossaryShow');
	
	GPOverPU();
	if (!glossaryOpen_b)
	{		
		document.getElementById("glossaryContainer").style.top="100px";
		$("#glossaryContainer").draggable('enable');
	}	
	if (term)
	{
		showTerm(term);
	}	
	glossaryOpen_b = true;
}

/*function closeGlossaryPod()
{
	//if (glossaryOpen_b)
	//{
		//$("#glossaryContainer").draggable('disable');
		document.getElementById("glossaryContainer").style.top="-1000px";
	//}
	glossaryOpen_b = false;	
}*/		

function openPopUpWindow(content_path, pop_title, w, h)
{	
	//alert("In openPopUpWindow at least.");
	var url = content_path;
	newPopUp=window.open(url,'pop','width='+w+',height='+h+',screenX=150,screenY=100,top=100,left=150,resizable=1,scrollbars=1');
}

function getModuleDataUrl()
{
	var vars_obj = getQueryVars();
	moduleData_url = vars_obj.moduleData_url;
	return moduleData_url;
}

function getQueryVars()
{
	var url = document.location.toString();
	var start = url.indexOf("?") + 1;
	var vars_str = url.substring(start);
	var vars_arr = vars_str.split('&');
	var vars_obj = {};
	/*var dev = "";*/
	for (i=0; i<vars_arr.length; i++)
	{
		var_arr = vars_arr[i].split("=");
		vars_obj[var_arr[0]] = var_arr[1];
		//dev += "\r\r" + var_arr[0] + "="  + var_arr[1];
	}
	return vars_obj;
}

 function parseJSON()
 {
	course_name = jxml.course_name;
	//alert("course_name: " + course_name);
	block_text = jxml.block_text;
	
	defaultBlockTitle = jxml.defaultBlockTitle;
	
	pages_arr = new Array();
	var page_arr;
	if (jxml.pages_arr)
	{
		//alert("parseJSON :: (jxml.pages_arr): true");
		page_arr = jxml.pages_arr.page;
	} else {
		//alert("parseJSON :: (jxml.pages_arr): false");
		page_arr = jxml.page;
	}
	
	for (var i=0; i<page_arr.length; i++)
	{
		var pg_obj = new Object();
		pg_obj.title = page_arr[i].pageTitle;
		pg_obj.url = page_arr[i].url;
		pages_arr.push(pg_obj);
	}
 }
 
 /*function initBlocktext()
 {
	if (block_text.length > 0)
	{
		document.getElementById("headerBlockContainer").style.display="inline";
		$("#headerBlockContainer").text(block_text);
	}
	else 
	{
		document.getElementById("headerBlockContainer").style.display="none";
	}
 }*/
  
 function isIE()
 {
 	return (navigator.appName == "Microsoft Internet Explorer");
 }
 
 function init() // called on page open/refresh
{
	current_pg_ind = 0;
	var bk = window.location.hash;
	if (bk.length > 1)
	{
		current_pg_ind = parseInt(bk.substr(1));
	}
	if (current_pg_ind > pages_arr.length) { current_pg_ind = pages_arr.length; }
	bookmark();
	requestPage(current_pg_ind);
	createScrubberTicks();
	setScrubberIndex();
	
	$("#dev_current_pages").text(parseInt(current_pg_ind) + 1); // Displays the current page number
	$("#dev_pages_total").text("of " + pages_arr.length + " total"); // Displays total number of pages in lesson
		
	glossaryOpen_b = false;
	
	getFile('glossary/glossary_data.xml');
	
	/*$("div.clickableGP").click(
	function()
	{
		GPOverPU();
	});
	$("div.clickablePU").click(
	function()
	{
		PUOverGP();
	});*/
	
	hidePup(); //New popup code. Removes popup on page load.
}

function reqFocusGP() {GPOverPU(); }// cach GP EI
function GPOverPU()
{
	$('#glossaryContainer').css('zIndex', 131);
	$('#layerPopup').css('zIndex', 101);
	$('#glossaryLabelPopUp').css('zIndex', 132);
	return false;
}

function PUOverGP()
{
	$('#glossaryContainer').css('zIndex', 100);
	$('#layerPopup').css('zIndex', 130);
	$('#glossaryLabelPopUp').css('zIndex', 132);
	return false;
}


function resetPageEle()				
{
	clearFlowDiv();
}

function loadDivHTML(div_id, content_src)
{
	$("#" + div_id).load(content_src, bookmark);
	setGlossLinkListeners(); //Each time new content is loaded this function sets listeners on PU links.
}

function bookmark()
{	
	if (navigator.appName == "Netscape")
	{
		if (current_pg_ind.length < 1)
		{
			//alert("bookmark: current_pg_ind.length < 1");
		} else {
			//alert("bookmark: current_pg_ind: " + current_pg_ind);
		}
		current_pg_ind = parseInt(current_pg_ind);
		window.location.hash = current_pg_ind;//.toString();
		return false;
	} 
}

function goToPrev()
 { 	
	var prev_ind = current_pg_ind - 1;
	if (prev_ind > -1)
	{	
		current_pg_ind = prev_ind;
		requestPage(current_pg_ind);
		$("#dev_current_pages").text(current_pg_ind + 1);
		setScrubberIndex();
	} 	
 }
 
 function goToNext()
 {
	var next_ind = current_pg_ind + 1;
	if (next_ind <= pages_arr.length - 1)
	{
		current_pg_ind = next_ind;
		requestPage(current_pg_ind);
		$("#dev_current_pages").text(current_pg_ind + 1);
		setScrubberIndex();
	}
 }
 
 function clearFlowDiv() {
	swfobject.removeSWF("flow");
	swfobject.removeSWF("inPut");
	swfobject.removeSWF("WCLC");
}

 function clearInputSWF() {
	swfobject.removeSWF("inPut");
}

/* This function creates the tick marks and the listeners for the console page scrubber. MH */
function createScrubberTicks(){
	for(i=0; i< pages_arr.length; i++){
		$('#scrubberList').append('<li><span id="' + pages_arr[i].title + '" index="' + i + '" class="scrubberBtn">'</span></li>');
	}

    $('.scrubberBtn')
        .click(function(){
			$(this).removeClass("scrubberBtn").addClass("scrubberBtnSelected").parent().siblings().children().removeClass('scrubberBtnSelected').addClass('scrubberBtn');
			current_pg_ind = this.getAttribute("index");
			$("#dev_current_pages").text(parseInt(current_pg_ind) + 1);
			requestPage(current_pg_ind);
        })
        .mouseenter(function () {$('#page_display').html(this.id);})
        .mouseleave(function () {$('#page_display').html("");});
}

function setScrubberIndex()
{
	$("#scrubberList li span[index]").filter(function() { return $(this).attr('index'); }).each(function()
	{
		if($(this).attr("index") == parseInt(current_pg_ind))
		{
			$(this).removeClass("scrubberBtn").addClass("scrubberBtnSelected").parent().siblings().children().removeClass('scrubberBtnSelected').addClass('scrubberBtn');
			return false;
		}
	}); 
}


function onRollOverPULink() //e, txt
{
	alert("onRollOverPULink");
	/*var target = document.getElementById('glossaryLabelPopUp');	
	target.style.display = 'inline';
	target.innerHTML = getDef(txt);
	// TODO: if undefined, don't popup
	posPopupLabel(target, e);*/
}

function onRollOutPULink(e)
{
	document.getElementById('glossaryLabelPopUp').style.display = 'none';
}

function onClickPULink()
{
	alert("onClickPULink");
}
m2244 is offline   Reply With Quote
Old 10-05-2012, 09:06 PM   PM User | #12
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
Code:
function loadDivHTML(div_id, content_src)
{
	$("#" + div_id).load(content_src, bookmark);
	setGlossLinkListeners(); //Each time new content is loaded this function sets listeners on PU links.
}
remove the code in orange.


change this
Code:
function setGlossLinkListeners()
{
	/*$('#contentContainer a.glossaryLink').each(function() { 
		alert('this will alert for every li found.'); 
	}); */

	$('#contentContainer a.glossaryLink').on('hover', function(){
			onRollOverPULink();
	});
	/*$('a.glossaryLink').live("hover", function(event){
		alert("WTF");
	});
	.onmouseout(function(event){;
		onRollOutPULink(event);
	}).click(function(event){
		showHideGlossary();
	})*/
}
to this

Code:
$(document).ready(function(){

	$('a.glossaryLink').on('mouseover', function(){
		alert("you hovered on a glossary link);
	}).on('mouseout',function(event){
		onRollOutPULink(event);
	}).on('click',function(event){
          event.preventDefault();
		showHideGlossary();
	})
});
and see if that works
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Old 10-05-2012, 11:11 PM   PM User | #13
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,599
Thanks: 5
Thanked 865 Times in 842 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
Also, many browsers have a built-in error console/debugging tool. Learn to use that. If there are JS errors they will be shown there and many times it explains what’s wrong.
__________________
Don’t click this link!
VIPStephan is online now   Reply With Quote
Old 10-06-2012, 06:47 PM   PM User | #14
m2244
Regular Coder

 
Join Date: Jun 2012
Posts: 129
Thanks: 1
Thanked 1 Time in 1 Post
m2244 is an unknown quantity at this point
Quote:
Originally Posted by VIPStephan View Post
Also, many browsers have a built-in error console/debugging tool. Learn to use that. If there are JS errors they will be shown there and many times it explains what’s wrong.
I've been using FF, it gave no error indications.

Thanks for the help. I won't be able to try this until Tuesday.
m2244 is offline   Reply With Quote
Old 10-09-2012, 02:03 PM   PM User | #15
m2244
Regular Coder

 
Join Date: Jun 2012
Posts: 129
Thanks: 1
Thanked 1 Time in 1 Post
m2244 is an unknown quantity at this point
It works well in IE but FF and Chrome do nothing at all, no errors, no warnings. It appears as if the event listeners are not registering in FF or Chrome.

Edit: Ok I split up the .on event listeners. This seems to have done the trick with FF, Chrome stil not working. Very frustrating!

Last edited by m2244; 10-09-2012 at 03:32 PM..
m2244 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:22 PM.


Advertisement
Log in to turn off these ads.