If you want a link to cover an entire div, an idea would be to create an empty <a> tag as the first child: <div class=”covered-div”> <a class=”cover-link” href=”/my-link”></a> <!– other content as usual –> </div> div.covered-div { position: relative; } a.cover-link { position: absolute; top: 0; bottom: 0; left: 0; right: 0; } This Full Article…
jQuery – Show and hide Div on scroll
If you have a div that sits at the bottom of a slideshow that you want to disappear when the user scrolls down, and then reappears when scrolls back to the top, you can follow the below example. <div> <div class=”a”> A </div> </div> $(window).scroll(function() { if ($(this).scrollTop() > 0) { $(‘.a’).fadeOut(); } else { Full Article…
How to create X close button by using CSS
As a pure CSS solution for the close or ‘times’ symbol, you can use the ISO code with the content property. I often use this for :after or :before pseudo selectors. The content code is \00d7. Example div:after{ display: inline-block; content: “\00d7”; /* This will render the ‘X’ */ } You can then style and position Full Article…
jQuery – How check or uncheck all checkbox
In this tutorial, we are going to see how to check or uncheck a group of checkboxes using jQuery. We can use this feature in various scenarios like selecting multiple records to perform database updates or delete. In this tutorial, we have a simple example with less code for obtaining this feature using jQuery. Form Full Article…
Jquery – Get month text from date
You can use jQuery to generate the texts from date, month, or year. Here is an example: let date = new Date(2021, 06, 21); // 2021-06-21 let longMonth = date.toLocaleString(‘en-us’, { month: ‘long’ }); /* June */ let shortMonth = date.toLocaleString(‘en-us’, { month: ‘short’ }); /* Jun */ let narrowMonth = date.toLocaleString(‘en-us’, { month: ‘narrow’ Full Article…
Javascript – How to check and uncheck radio button on click
I was working with a client who was required to be able to uncheck the checked radio. I was struggling for many hours with that request. Finally, I find out a solution to solve that issue with Javascript. The solution is to track the selected state manually using the “click” event handler and a custom Full Article…
Google Chrome – How to run jQuery in console
Many times I need to test some elements in some web pages which I don’t own. If that webpage uses jQuery then it’s quite easy for us to do our testing; but if jQuery is not there, it’s a headache to do kinds of stuff with native JavaScript, because jQuery is always a better DOM Full Article…
Jquery – Start FancyBox on page load without clicking
When you want to open a popup on page load without click by using Fancybox, you can use this script: window.jQuery(document).ready(function() { $.fancybox.open('#popup_box'); }); Hope it will help ^^
Magento – Product Collection
In this blog, we will see some important function in magento product collection class. Product Collection class in magento is Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection. Lets look at the important functions Get All Products of a category 1 2 3 $collection = Mage::getResourceModel('catalog/product_collection') ->setStoreId($this->getStoreId()) ->addCategoryFilter($category); Tn this the addCategoryFilter() function, is used to get all products of a particular Full Article…
Magento – Functions cheatsheet
General functions Function Description $this->getRequest()->getServer(‘HTTP_REFERER’); Get the referer URL Product related functions Function Description $product->getName() Get product name $product->getSku() Get product sku Mage::getModel(‘cataloginventory/stock_item’)->loadByProduct($_product)->getQty() Get product stock $product->getResource()->getAttribute(‘color’)->getFrontend()->getValue($product) Get a product attribute value (like color/size) $product->isSaleable() checks if a product is salable $product->isisAvailable() checks if a product type is salable Mage::getModel(‘catalogrule/rule’)->calcProductPriceRule($product,$product->getPrice()) Gets the product final price Full Article…