Click here to Skip to main content
15,887,585 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: Blog portal - ASP.NET or PHP? Pin
Richard MacCutchan27-Oct-11 23:13
mveRichard MacCutchan27-Oct-11 23:13 
QuestionGoogle's development language Pin
Jassim Rahma24-Oct-11 8:24
Jassim Rahma24-Oct-11 8:24 
AnswerRe: Google's development language Pin
ryamx24-Oct-11 8:45
ryamx24-Oct-11 8:45 
GeneralRe: Google's development language Pin
Skynet_Code29-Nov-11 4:03
Skynet_Code29-Nov-11 4:03 
AnswerRe: Google's development language Pin
Richard MacCutchan24-Oct-11 21:51
mveRichard MacCutchan24-Oct-11 21:51 
AnswerRe: Google's development language Pin
David Skelly24-Oct-11 22:41
David Skelly24-Oct-11 22:41 
Questiontext boxes in graphical view Pin
roselotus22-Oct-11 12:52
roselotus22-Oct-11 12:52 
QuestionIE6 Pain...jQuery Show / Hide Plugin Pin
AndyInUK21-Oct-11 1:51
AndyInUK21-Oct-11 1:51 
I am trying to implement jQuery Show / Hide Plugin

I have tried enough to rectify the problem, but it doesn't work on IE6, where as it works like a charm on other browsers.

plugin

JavaScript
(function ($) {
02	    $.fn.showHide = function (options) {
03	 
04	    //default vars for the plugin
05	        var defaults = {
06	            speed: 1000,
07	            easing: '',
08	            changeText: 0,
09	            showText: 'Show',
10	            hideText: 'Hide',
11	 
12	        };
13	        var options = $.extend(defaults, options);
14	 
15	        $(this).click(function () {
16	             // this var stores which button you've clicked
17	             var toggleClick = $(this);
18	             // this reads the rel attribute of the button to determine which div id to toggle
19	             var toggleDiv = $(this).attr('rel');
20	             // here we toggle show/hide the correct div at the right speed and using which easing effect
21	             $(toggleDiv).slideToggle(options.speed, options.easing, function() {
22	             // this only fires once the animation is completed
23	             if(options.changeText==1){
24	             $(toggleDiv).is(":visible") ? toggleClick.text(options.hideText) : toggleClick.text(options.showText);
25	             }
26	              });
27	 
28	          return false;
29	 
30	        });
31	 
32	    };
33	})(jQuery);


The usage

JavaScript
$(document).ready(function(){
02	 
03	   $('.show_hide').showHide({
04	        speed: 1000,  // speed you want the toggle to happen
05	        easing: '',  // the animation effect you want. Remove this line if you dont want an effect and if you haven't included jQuery UI
06	        changeText: 1, // if you dont want the button text to change, set this to 0
07	        showText: 'View',// the button text to show when a div is closed
08	        hideText: 'Close' // the button text to show when a div is open
09	 
10	    });
11	 
12	});


HTML

HTML
01	<a href="#" class="show_hide" rel="#slidingDiv">View</a><br />
02	   <div id="slidingDiv" style="display:none;">
03	       Fill this space with really interesting content.
04	   </div>
05	 
06	<a href="#" class="show_hide" rel="#slidingDiv_2">View</a><br />
07	   <div id="slidingDiv_2" style="display:none;">
08	       Fill this space with really interesting content.
09	   </div>


Anything ideas?

Thanks
AnswerRe: IE6 Pain...jQuery Show / Hide Plugin Pin
Dennis E White21-Oct-11 4:06
professionalDennis E White21-Oct-11 4:06 
GeneralRe: IE6 Pain...jQuery Show / Hide Plugin Pin
AndyInUK21-Oct-11 6:19
AndyInUK21-Oct-11 6:19 
GeneralRe: IE6 Pain...jQuery Show / Hide Plugin Pin
Dennis E White21-Oct-11 10:01
professionalDennis E White21-Oct-11 10:01 
QuestionHow do I center a <div> vertically? Pin
Xarzu18-Oct-11 23:15
Xarzu18-Oct-11 23:15 
AnswerRe: How do I center a vertically? Pin
Dennis E White20-Oct-11 11:24
professionalDennis E White20-Oct-11 11:24 
QuestionFormulas Pin
BobInNJ9-Oct-11 5:19
BobInNJ9-Oct-11 5:19 
AnswerRe: Formulas Pin
killabyte9-Oct-11 16:48
killabyte9-Oct-11 16:48 
AnswerRe: Formulas Pin
Dalek Dave12-Oct-11 22:56
professionalDalek Dave12-Oct-11 22:56 
GeneralRe: Formulas Pin
BobInNJ13-Oct-11 8:04
BobInNJ13-Oct-11 8:04 
AnswerRe: Formulas Pin
Shameel12-Oct-11 23:17
professionalShameel12-Oct-11 23:17 
AnswerRe: Formulas Pin
AditSheth13-Oct-11 19:40
AditSheth13-Oct-11 19:40 
AnswerRe: Formulas Pin
phil.o28-Oct-11 2:29
professionalphil.o28-Oct-11 2:29 
QuestionPublishing website with Report Viewer control Pin
countmein6-Oct-11 15:18
countmein6-Oct-11 15:18 
AnswerRe: Publishing website with Report Viewer control Pin
countmein9-Oct-11 4:03
countmein9-Oct-11 4:03 
AnswerHow to receive dataset in jquery Pin
goplappu3-Oct-11 20:51
goplappu3-Oct-11 20:51 
GeneralRe: How to receive dataset in jquery Pin
Dennis E White8-Oct-11 15:41
professionalDennis E White8-Oct-11 15:41 
Questionjquery Pin
goplappu3-Oct-11 20:50
goplappu3-Oct-11 20:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.