Results 1 to 2 of 2

Thread: Pop-up window in 'crosstick.htm'

  1. #1
    Join Date
    Jan 2009
    Location
    Brighton UK
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Pop-up window in 'crosstick.htm'

    1) Script Title: Pausing up-down scroller

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex2/crosstick.htm

    3) Describe problem: I am using this script successfully just as an event scroller with NO links to any external/internal pages, however I would like to incorporate links to internal pages which I am able to do but as these links will be to small pages I would like to have these come up in a 'pop-up' window rather than FULL window/tab etc. I am already using a 'pop-up' window script but don't know how to incorporate it. Anyone have any ideas

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    There are a few ways to go about this. One elegant solution is to re-route any click action occurring within the scroller, and if it's a link, perform a custom action (such as opening the link in a popup) while disabling the default behavior of following through with the link. Given the below sample initialization code, the added code in red does this:

    Code:
    <script type="text/javascript">
    
    //new pausescroller(name_of_message_array, CSS_ID, CSS_classname, pause_in_miliseconds)
    
    new pausescroller(pausecontent, "pscroller1", "someclass", 3000)
    document.write("<br />")
    new pausescroller(pausecontent2, "pscroller2", "someclass", 2000)
    
    var myscroller=document.getElementById('pscroller1')
    myscroller.onclick=function(e){
    	var evt=e || window.event
    	if (!evt.target)
    		evt.target=evt.srcElement
    	if (evt.target.tagName=="A")
    		window.open(evt.target.href) //custom action to perform on clicked link
    	if (evt.preventDefault) //stop link from following through
    		evt.preventDefault()
    	else
    		return false
    }
    
    </script>
    You'll want to change the line in red to perform the desired action when a link is clicked on, such as call your popup window function with the passed link.
    DD Admin

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
  •