Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12
  1. #11
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Clickable Background Image - How To?

    If you already have a text link next to the background icon you want to make clickable, you can use your stylesheet to spread out the clickable area as desired. Say the link has a classname of shoppingcartLink, you could do
    Code:
    .shoppingcartLink {
        display: block;
        height: 30px;
        width: 66px;
        position: absolute;
        left: 123px;
        top: 42px;
        }
    or several other ways of locating it in the correct position.

  2. #12
    Join Date
    Jan 2008
    Posts
    139
    Plugin Contributions
    0

    Default Re: Clickable Background Image - How To?

    Quote Originally Posted by davewest View Post
    basically, yes... look for the shopping cart code, it should be in includes\templates\MY_TEMPLATE\common\tpl_header.php ...you may have to do the image by its self are play around a bit to get things lined up right.
    Wow, I think I finally got it. I took pretty much the same approach that you outlined here, but I couldn't get the image to line up - it bumped up against the cart text link, and caused it to wrap down, so I went back to the drawing board. Here's how I resolved it:


    1). Commented the image reference out of stylesheet.css:
    Code:
    /*background: url(../images/cart_bg.png) no-repeat; */
    2). Found the bit of code in tpl_header.php that created the Shopping Cart link (as shown in the attached image of my previous post). In the case of my custom template, it is...:
    Code:
    <div id="cart_top"><a href="<?php echo HTTP_SERVER . DIR_WS_CATALOG ?>index.php?main_page=shopping_cart"><?php echo BOX_HEADING_SHOPPING_CART; ?></a><br /><?php echo $_SESSION['cart']->count_contents();?> item(s) - <?php echo $currencies->format($_SESSION['cart']->show_total());?></div>
    3). ...and created a new <div> immediately before the above line. This new <div> contained my new cart image source and link:
    Code:
    <div id="cart_img"><a href="<?php echo HTTP_SERVER . DIR_WS_CATALOG ?>index.php?main_page=shopping_cart"><?php echo zen_image(DIR_WS_TEMPLATE.'images/cart_bg.png'); ?></a></div>
    4). Finally, I referenced the new <div> in stylesheet.css to set the absolute position of the cart image:
    Code:
    #cart_img {
    	position: absolute;
    	right: 115px;
    	top: 44px;
    	}
    Whew! I've been image-mapping, and trying to link background images for some time, now... Once you had me thinking in a different direction, it forced me to step back from the trees and take a fresh look at it. It all seems so logical, now!

    Thanks for all the input!

    -DBB1

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Clickable Background image
    By Lazar in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 16 Feb 2017, 02:42 PM
  2. v150 Re: Can I make background Image clickable link?
    By scott_ease in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 30 Nov 2014, 08:40 AM
  3. Can I make background Image clickable link??
    By gaffettape in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 21 Apr 2010, 12:40 AM
  4. add background image to a attribute then have that background image act as hyperlink
    By sike1234 in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 14 Nov 2008, 05:38 PM
  5. How to Change Background Colour to Background image
    By ittybittykitty in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 9 Aug 2008, 04:36 PM

Posting Permissions

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