Results 1 to 4 of 4

Thread: Switch Content Script - how to put plus/minus image alignment issue

  1. #1
    Join Date
    Dec 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Switch Content Script - how to put plus/minus image alignment issue

    The Switch Content script comes with an X or Check image to display the collapsed status. My issue is that I want the X and Check to show after my title text, not before it. Is there a way to easily do that? I've scanned through the .js with no avail.

    http://www.dynamicdrive.com/dynamici...tchcontent.htm

    Thanks,
    Russ

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    2,025
    Thanks
    16
    Thanked 315 Times in 313 Posts
    Blog Entries
    13

    Default

    Untested (on iphone) but maybe a float:right style in the img tag?
    Code:
    <script type="text/javascript">
    ...
    bobexample.setStatus('<img src="open.png" style="float:right" /> ', '<img src="close.png" style="float:right" /> ')
    ...
    bobexample.init()
    </script>
    Focus on Function Web Design | Latest News RSS | Facebook | Twitter |
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps |
    The only limit to creativity is imagination: JemCon.org

  3. #3
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,815
    Thanks
    2
    Thanked 425 Times in 419 Posts

    Default

    Code:
    switchcontent.prototype.togglestatus=function(header, status){
    	if (typeof this.statusOpen!="undefined")
    		header.getElementsByTagName('SPAN')[0].innerHTML=status
    }
    Code:
    switchcontent.prototype.init=function(){
    	var instanceOf=this
    	this.collectElementbyClass(this.className) //Get all headers and its corresponding content based on shared class name of contents
    	if (this.headers.length==0) //If no headers are present (no contents to switch), just exit
    		return
    	//If admin has changed number of days to persist from current cookie records, reset persistence by deleting cookie
    	if (this.persistType=="days" && (parseInt(switchcontent.getCookie(this.className+"_dtrack"))!=this.persistDays))
    		switchcontent.setCookie(this.className+"_d", "", -1) //delete cookie
    	// Get ids of open contents below. Four possible scenerios:
    	// 1) Session only persistence is enabled AND corresponding cookie contains a non blank ("") string
    	// 2) Regular (in days) persistence is enabled AND corresponding cookie contains a non blank ("") string
    	// 3) If there are contents that should be enabled by default (even if persistence is enabled and this IS the first page load)
    	// 4) Default to no contents should be expanded on page load ("" value)
    	var opencontents_ids=(this.persistType=="session" && switchcontent.getCookie(this.className)!="")? ','+switchcontent.getCookie(this.className)+',' : (this.persistType=="days" && switchcontent.getCookie(this.className+"_d")!="")? ','+switchcontent.getCookie(this.className+"_d")+',' : (this.expandedindices)? ','+this.expandedindices+',' : ""
    	for (var i=0; i<this.headers.length; i++){ //BEGIN FOR LOOP
    		if (typeof this.ajaxheaders["header"+i]!="undefined"){ //if this is an Ajax header
    			this.headers[i].ajaxstatus='waiting' //two possible statuses: "waiting" and "loaded"
    			this.headers[i].ajaxfile=this.ajaxheaders["header"+i]
    		}
    		if (typeof this.statusOpen!="undefined"){ //If open/ closing HTML indicator is enabled/ set
    			this.headers[i].innerHTML=this.headers[i].innerHTML+'<span class="status"></span>' //Add a span element to original HTML to store indicator
    		}
            if (opencontents_ids.indexOf(','+i+',')!=-1){ //if index "i" exists within cookie string or default-enabled string (i=position of the content to expand)
    			this.expandcontent(this.headers[i]) //Expand each content per stored indices (if ""Collapse Previous" is set, only one content)
    			if (this.collapsePrev) //If "Collapse Previous" set
    			this.prevHeader=this.headers[i]  //Indicate the expanded content's corresponding header as the last clicked on header (for logic purpose)
    		}
    		else //else if no indices found in stored string
    			this.contractcontent(this.headers[i]) //Contract each content by default
    		this.headers[i].onclick=function(){instanceOf.toggledisplay(this)}
    	} //END FOR LOOP
    	switchcontent.dotask(window, function(){instanceOf.rememberpluscleanup()}, "unload") //Call persistence method onunload
    }
    Vic
    God Loves You and will never love you less.
    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

  4. #4
    Join Date
    Dec 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    That worked like a charm vwphillips. Thank you both for helping out on this one, it was a real time saver for me! Cheers to your health!

Similar Threads

  1. Switch Content script - swap anchor image when selected
    By katebellami in forum Looking for such a script or service
    Replies: 8
    Last Post: 06-07-2012, 01:16 PM
  2. Firefox table issue with Switch Content script
    By bobolibob in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 04-10-2009, 06:02 AM
  3. Switch Content Script Issue II
    By alexjewell in forum Dynamic Drive scripts help
    Replies: 9
    Last Post: 08-25-2006, 09:47 PM
  4. DIV alignment issue with Cmotoin type script
    By seangossard in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 01-12-2006, 11:09 PM
  5. Switch Content Script - image not loading in IE
    By cdart in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 06-11-2005, 01:03 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •